From 17e800c6edd889c6b7b4826adb944ab32a45f1b2 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Mon, 1 Aug 2011 14:42:40 +0200 Subject: Added get_map_property lua function. mana.get_map_prpoperty(string) can now be used to read a property from a map file. String is the property name. Resolves: Mana-Mantis #353. Reviewed-by: Bertram. --- src/scripting/lua.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/scripting/lua.cpp') diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index d461bf44..553c8593 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -1788,6 +1788,29 @@ static int get_map_id(lua_State *s) return 1; } +/** + * Returns the value of a map property + */ +static int get_map_property(lua_State *s) +{ + const char *property = luaL_checkstring(s, 1); + lua_pushlightuserdata(s, (void *)®istryKey); + lua_gettable(s, LUA_REGISTRYINDEX); + Script *t = static_cast