luvit-redis
luvit-redis copied to clipboard
Example.lua script exits and doesn't wait for callbacks
I'm new to luvit so I'm not sure if this is the fault of luvit or of luvit-redis. When I run luvit on example.lua, I don't get any output. I only get output if I set up a server that is listening on a port, by adding the lines below:
-- Load the http library
local HTTP = require("http")
-- Create a simple nodeJS style hello-world server
HTTP.createServer(function (req, res)
local body = "Hello World\n"
res:writeHead(200, {
["Content-Type"] = "text/plain",
["Content-Length"] = #body
})
res:finish(body)
end):listen(8080)
I think this may be happening because luvit exits before the redis.print callbacks have a chance to fire.
I'm on OSX 10.8.4 / luvit 0.6.1 (brew) / latest luvit-redis (04f1fe8bd0968764be7b2f2fb7b53781686ec630).