Mercurial Hosting > luan
changeset 1688:5eb985d1411f
'http/serve.luan' now allows overriding port
author | Fox |
---|---|
date | Sat, 11 Jun 2022 21:14:19 +0200 |
parents | f48db13ae2d9 |
children | af22d6c120e4 |
files | src/luan/modules/http/serve.luan |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/modules/http/serve.luan Thu Jun 09 19:44:41 2022 -0600 +++ b/src/luan/modules/http/serve.luan Sat Jun 11 21:14:19 2022 +0200 @@ -1,10 +1,15 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error local Io = require "luan:Io.luan" local Server = require "luan:http/Server.luan" - +local String = require "luan:String.luan" +local to_number = String.to_number or error() -if #{...} ~= 1 then - Io.stderr.write "usage: luan luan:http/serve.luan dir\n" +local count = #{...} + +if count < 1 or count > 2 then + Io.stderr.write "usage: luan luan:http/serve.luan dir port\n" return end -Server.serve(...) +Server.serve({...}[1],to_number({...}[2])) \ No newline at end of file