buildat/client/init.lua

56 lines
1.2 KiB
Lua
Raw Normal View History

2014-09-18 21:54:29 +03:00
-- Buildat: client/init.lua
buildat = {}
2014-09-19 13:33:18 +03:00
function buildat.dump(thing)
if type(thing) == 'string' then
return '"'..thing..'"'
end
if type(thing) == 'number' then
return ''..thing
end
if thing == nil then
return "nil"
end
if type(thing) == 'table' then
local s = "{"
local first = true
for k, v in pairs(thing) do
if not first then s = s..", " end
s = s.."["..buildat.dump(k).."] = "..buildat.dump(v)
first = false
end
s = s.."}"
return s
end
return "(?)"
end
2014-09-19 14:50:25 +03:00
function buildat.Logger(module)
2014-09-18 21:54:29 +03:00
local logger = {}
2014-09-19 13:33:18 +03:00
function fix_text(text)
if type(text) == 'string' then
return text
end
return buildat.dump(text)
end
2014-09-18 21:54:29 +03:00
function logger:info(text)
2014-09-19 13:33:18 +03:00
text = fix_text(text)
2014-09-18 21:54:29 +03:00
print(os.date("%b %d %H:%M:%S "..module..": "..text))
end
2014-09-19 03:07:37 +03:00
function logger:error(text)
2014-09-19 13:33:18 +03:00
text = fix_text(text)
2014-09-19 03:07:37 +03:00
print(os.date("%b %d %H:%M:%S "..module.." ERROR: "..text))
end
2014-09-18 21:54:29 +03:00
return logger
end
2014-09-19 14:50:25 +03:00
local log = buildat.Logger("__client/init")
2014-09-18 21:54:29 +03:00
log:info("init.lua loaded")
dofile(__buildat_get_path("share").."/client/test.lua")
dofile(__buildat_get_path("share").."/client/packet.lua")
2014-09-19 11:29:23 +03:00
dofile(__buildat_get_path("share").."/client/extensions.lua")
dofile(__buildat_get_path("share").."/client/sandbox.lua")
2014-09-18 21:54:29 +03:00
2014-09-19 11:29:23 +03:00
local test = require("buildat/extension/test")
test.f()