- added some more lua commands:

vector<int> getUnitsForFaction(factionIndex,commandTypeName, field)
int getUnitCurrentField(unitId)
This commit is contained in:
Mark Vejvoda
2012-03-30 07:10:14 +00:00
parent 45b92f4316
commit c02c90427b
6 changed files with 106 additions and 33 deletions

View File

@@ -80,6 +80,7 @@ public:
void returnInt(int value);
void returnString(const string &value);
void returnVec2i(const Vec2i &value);
void returnVectorInt(const vector<int> &value);
private:
void throwLuaError(const string &message) const;

View File

@@ -614,6 +614,19 @@ void LuaArguments::returnVec2i(const Vec2i &value){
lua_rawseti(luaState, -2, 2);
}
void LuaArguments::returnVectorInt(const vector<int> &value) {
//Lua_STREFLOP_Wrapper streflopWrapper;
++returnCount;
lua_newtable(luaState);
for(unsigned int i = 0; i < value.size(); ++i) {
lua_pushnumber(luaState, value[i]);
lua_rawseti(luaState, -2, i+1);
}
}
void LuaArguments::throwLuaError(const string &message) const{
Lua_STREFLOP_Wrapper streflopWrapper;