mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
Use new coding style in game modules
Lots of refactoring and changes Remove docs folder
This commit is contained in:
@@ -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 {}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user