diff options
author | Philipp Sehmisch <crush@themanaworld.org> | 2009-01-21 22:27:35 +0100 |
---|---|---|
committer | Philipp Sehmisch <crush@themanaworld.org> | 2009-01-21 22:27:35 +0100 |
commit | ece7a5e46a92a5cbf88bb72892dfc67dba059859 (patch) | |
tree | b8085e70dd24c038927df0f8a4306044670bbd69 /src | |
parent | 64877056e3b297707b02c93f89185cea6a5f39a3 (diff) | |
download | manaserv-ece7a5e46a92a5cbf88bb72892dfc67dba059859.tar.gz manaserv-ece7a5e46a92a5cbf88bb72892dfc67dba059859.tar.bz2 manaserv-ece7a5e46a92a5cbf88bb72892dfc67dba059859.tar.xz manaserv-ece7a5e46a92a5cbf88bb72892dfc67dba059859.zip |
Added script command to get the id of the current map (requested by Invertika).
Diffstat (limited to 'src')
-rw-r--r-- | src/scripting/lua.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index aead80cb..e711623d 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -1151,6 +1151,18 @@ static int LuaTest_Tableget(lua_State *s) return 4; } +/** + * Returns the ID of the current map + */ +static int LuaGet_MapId(lua_State *s) +{ + lua_pushlightuserdata(s, (void *)®istryKey); + lua_gettable(s, LUA_REGISTRYINDEX); + Script *t = static_cast<Script *>(lua_touserdata(s, -1)); + int id = t->getMap()->getID(); + lua_pushinteger(s, id); + return 1; +} LuaScript::LuaScript(): nbArgs(-1) @@ -1191,6 +1203,7 @@ LuaScript::LuaScript(): { "note_on_death", &LuaNoteOnDeath }, { "effect_create", &LuaEffect_Create }, { "test_tableget", &LuaTest_Tableget }, + { "get_map_id", &LuaGet_MapId }, { NULL, NULL } }; luaL_register(mState, "tmw", callbacks); |