summaryrefslogtreecommitdiff
path: root/src/scripting
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-11 18:16:16 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-11 19:27:32 +0100
commit5ff34fd2458dff28d664c90fb93f455231f8633c (patch)
tree533151e5f3002c1e24ce4d44e5cd32c66c026b51 /src/scripting
parentb822dcee52d15d41c4186a250e73b85b16c9dc39 (diff)
downloadmanaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.gz
manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.bz2
manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.xz
manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.zip
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
Diffstat (limited to 'src/scripting')
-rw-r--r--src/scripting/lua.cpp5
1 files changed, 3 insertions, 2 deletions
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 },