1
0

Improved DoWithID bindings.

This commit is contained in:
Mattes D 2015-03-19 16:24:32 +01:00
parent 241c441de7
commit 2fed8c3227
2 changed files with 8 additions and 3 deletions

View File

@ -638,11 +638,11 @@ static int tolua_DoWithID(lua_State* tolua_S)
private: private:
virtual bool Item(Ty2 * a_Item) override virtual bool Item(Ty2 * a_Item) override
{ {
lua_rawgeti(LuaState, LUA_REGISTRYINDEX, FuncRef); // Push function to call lua_rawgeti(LuaState, LUA_REGISTRYINDEX, FuncRef); // Push function to call
tolua_pushusertype(LuaState, a_Item, Ty2::GetClassStatic()); // Push the item tolua_pushusertype(LuaState, a_Item, a_Item->GetClass()); // Push the item
if (TableRef != LUA_REFNIL) if (TableRef != LUA_REFNIL)
{ {
lua_rawgeti(LuaState, LUA_REGISTRYINDEX, TableRef); // Push the optional callbackdata param lua_rawgeti(LuaState, LUA_REGISTRYINDEX, TableRef); // Push the optional callbackdata param
} }
int s = lua_pcall(LuaState, (TableRef == LUA_REFNIL ? 1 : 2), 1, 0); int s = lua_pcall(LuaState, (TableRef == LUA_REFNIL ? 1 : 2), 1, 0);

View File

@ -189,6 +189,11 @@ public:
return "cMap"; return "cMap";
} }
const char * GetClass(void) // Needed for ManualBindings' DoWith templates
{
return "cMap";
}
protected: protected: