From 5ff34fd2458dff28d664c90fb93f455231f8633c Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 11 Mar 2012 18:16:16 +0100 Subject: Register Lua script API functions into the global namespace Scripts mostly execute the Mana script API, and it seems like just unnecessary verbosity to refer to the 'mana' table all the time. This table no longer exists now. Reviewed-by: Erik Schilling --- src/scripting/lua.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/scripting/lua.cpp') diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 273bdf42..9eca2df6 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -2239,8 +2239,9 @@ LuaScript::LuaScript(): { "announce", &announce }, { NULL, NULL } }; - luaL_register(mRootState, "mana", callbacks); - lua_pop(mRootState, 1); // pop the 'mana' table + lua_pushvalue(mRootState, LUA_GLOBALSINDEX); + luaL_register(mRootState, NULL, callbacks); + lua_pop(mRootState, 1); // pop the globals table static luaL_Reg const members_ItemClass[] = { { "on", &item_class_on }, -- cgit v1.2.3-70-g09d2