From 34ac0d64e23f2b2d3981dbb0ea72157f334805dd Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 26 Feb 2012 22:06:10 +0100 Subject: 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 --- scripts/lua/libmana.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/lua') 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 -- cgit