Mercurial Hosting > luan
comparison src/luan/modules/http/serve.luan @ 1688:5eb985d1411f
'http/serve.luan' now allows overriding port
author | Fox |
---|---|
date | Sat, 11 Jun 2022 21:14:19 +0200 |
parents | 307e76ccd0d6 |
children | af22d6c120e4 |
comparison
equal
deleted
inserted
replaced
1687:f48db13ae2d9 | 1688:5eb985d1411f |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
1 local Io = require "luan:Io.luan" | 3 local Io = require "luan:Io.luan" |
2 local Server = require "luan:http/Server.luan" | 4 local Server = require "luan:http/Server.luan" |
5 local String = require "luan:String.luan" | |
6 local to_number = String.to_number or error() | |
3 | 7 |
8 local count = #{...} | |
4 | 9 |
5 if #{...} ~= 1 then | 10 if count < 1 or count > 2 then |
6 Io.stderr.write "usage: luan luan:http/serve.luan dir\n" | 11 Io.stderr.write "usage: luan luan:http/serve.luan dir port\n" |
7 return | 12 return |
8 end | 13 end |
9 | 14 |
10 Server.serve(...) | 15 Server.serve({...}[1],to_number({...}[2])) |