Skip to content

Commit

Permalink
elem.property and elem.element can read Identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Mar 15, 2014
1 parent 258aaed commit 5b67c8c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/lua/LuaScriptInterface.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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");
}
Expand Down

0 comments on commit 5b67c8c

Please sign in to comment.