elem.property and elem.element can read Identifiers

This commit is contained in:
jacob1 2014-03-15 14:20:40 -04:00
parent 258aaedb0a
commit 5b67c8ce68

View File

@ -214,12 +214,14 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
lua_setfield(l, tptProperties, "mousex");
lua_pushinteger(l, 0);
lua_setfield(l, tptProperties, "mousey");
lua_pushstring(l, "");
lua_pushstring(l, "DEFAULT_PT_DUST");
lua_setfield(l, tptProperties, "selectedl");
lua_pushstring(l, "");
lua_pushstring(l, "DEFAULT_PT_NONE");
lua_setfield(l, tptProperties, "selectedr");
lua_pushstring(l, "");
lua_pushstring(l, "DEFAULT_PT_NONE");
lua_setfield(l, tptProperties, "selecteda");
lua_pushstring(l, "DEFAULT_PT_NONE");
lua_setfield(l, tptProperties, "selectedreplace");
lua_newtable(l);
tptPropertiesVersion = lua_gettop(l);
@ -2176,6 +2178,8 @@ int LuaScriptInterface::elements_element(lua_State * l)
}
lua_setfield(l, -2, (*iter).Name.c_str());
}
lua_pushstring(l, luacon_sim->elements[id].Identifier);
lua_setfield(l, -2, "Identifier");
return 1;
}
}
@ -2345,6 +2349,11 @@ int LuaScriptInterface::elements_property(lua_State * l)
}
return 1;
}
else if(propertyName == "Identifier")
{
lua_pushstring(l, luacon_sim->elements[id].Identifier);
return 1;
}
else
return luaL_error(l, "Invalid element property");
}