Use new coding style in game modules

Lots of refactoring and changes
Remove docs folder
This commit is contained in:
Eduardo Bart
2012-07-24 02:30:08 -03:00
parent 1c3e630237
commit c54cd1fdf1
69 changed files with 1629 additions and 2634 deletions

View File

@@ -2,6 +2,7 @@
-- root widget
rootWidget = g_ui.getRootWidget()
modules = package.loaded
-- G is used as a global table to save variables in memory between reloads
G = G or {}

View File

@@ -36,7 +36,17 @@ function quit()
g_app.quit()
end
function connect(object, signalsAndSlots, pushFront)
function connect(object, arg1, arg2, arg3)
local signalsAndSlots
local pushFront
if type(arg1) == 'string' then
signalsAndSlots = { [arg1] = arg2 }
pushFront = arg3
else
signalsAndSlots = arg1
pushFront = arg2
end
for signal,slot in pairs(signalsAndSlots) do
if not object[signal] then
local mt = getmetatable(object)
@@ -150,6 +160,14 @@ local function module_loader(modname)
end
table.insert(package.loaders, 1, module_loader)
function import(table)
assert(type(table) == 'table')
local env = getfenv(2)
for k,v in pairs(table) do
env[k] = v
end
end
function export(what, key)
if key ~= nil then
_G[key] = what