Skip to content

Instantly share code, notes, and snippets.

@katlogic
katlogic / server_hello.lua
Last active March 1, 2016 12:10 — forked from daurnimator/server_hello.lua
Prototyping lua-http server api
require('lazyserver')(8000, {
-- note that query string is not considered in the pattern
["^/(.*)"] = function(self, cap1)
self.content_type = 'text/plain'
self:write('halo halo, you requested '+self.url[1]+', pattern captured '+cap1+', args supplied '+self.param)
return 200
end)
}
-- for even more lazy:
@katlogic
katlogic / 52emu.lua
Created September 26, 2015 19:21 — forked from SoniEx2/52emu.lua
local track={}
setmetatable(track,{__mode="v"})
function setmetatable52(t,mt)
if mt.__gc then
local p = newproxy(true)
track[p] = t
getmetatable(p).__gc = function(p)
local mt = debug.getmetatable(t)
if mt and rawget(mt, "__gc") then
rawget(mt, "__gc")(t)