summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-02-26 22:06:10 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-02 18:12:07 +0100
commit34ac0d64e23f2b2d3981dbb0ea72157f334805dd (patch)
tree114b1f7a65956c097f7a59078292c9fa29c6451f /scripts
parente896d0b0125b48e12d43d99ace4498e56d968d50 (diff)
downloadmanaserv-34ac0d64e23f2b2d3981dbb0ea72157f334805dd.tar.gz
manaserv-34ac0d64e23f2b2d3981dbb0ea72157f334805dd.tar.xz
manaserv-34ac0d64e23f2b2d3981dbb0ea72157f334805dd.zip
Merged all the different Lua states into one
No more Lua state for each status effect, monster, item effect or map. All scripts are loaded into the same state. This should be more efficient overall and make it easier to implement dynamic reloading of the scripts in the future. Now, this introduces the problem of name collisions between different Lua scripts. For now this is solved by using more specific function names, like 'tick_plague' and 'tick_jump' rather than just 'tick'. The plan is however to get rid of these globals, and register these callbacks from the script, so that they can be local functions without the danger of colliding with other scripts. Reviewed-by: Erik Schilling Reviewed-by: Yohann Ferreira
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lua/libmana.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/lua/libmana.lua b/scripts/lua/libmana.lua
index 361fd7d..8b13911 100644
--- a/scripts/lua/libmana.lua
+++ b/scripts/lua/libmana.lua
@@ -318,13 +318,13 @@ function create_npc_delayed(name, id, x, y)
npc_handler = nil
end
--- Called during map initialization.
+-- Called during map initialization, for each map.
-- Executes all the functions registered by atinit.
function initialize()
for i,f in ipairs(init_fun) do
f()
end
- init_fun = nil
+ init_fun = {}
end