在go中使用lua示例, 基于gopher-lua!
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

42 líneas
892 B

unilight = unilight or {}
os.time = go.time.luatime()
os.msectime = go.time.Msec
os.nsectime = go.time.Nsec
-- log --
unilight.debug = function(...)
local arg = {...}
go.logging.debug(arg[1], arg[2] or {})
end
unilight.info = function(...)
local arg = {...}
go.logging.info(arg[1], arg[2] or {})
end
unilight.warn = function(...)
print("unilight-warn:" .. tostring(...))
local arg = {...}
go.logging.warning(arg[1], arg[2] or {})
end
unilight.error = function(...)
local arg = {...}
if next(arg) == nil then
unilight.error(debug.traceback())
end
go.logging.error(arg[1], arg[2] or {})
end
unilight.stack = function(...)
local arg = {...}
print("unilight-stack:" .. tostring(...))
end
unilight.tablefiles = function()
return luar.slice2table(go.getLuaFiles(go.tablePath))
end
unilight.scriptfiles = function()
return luar.slice2table(go.getLuaFiles(go.scriptPath))
end