int tLuaObject::generic_index(lua_State *L) { tLuaObject* lua_obj = tLuaObject::getObject(L, index_table_param); // gets the field name const char* field_name = lua_tostring(L, index_index_param); // finds in the method table tMethodType method_type; tLuaObjectMethod method; bool found = lua_obj->method_table.FindMethod(field_name, &method, &method_type); if(!found) return lua_obj->index(L); // calls method switch(method_type) { case FUNC: luaCompat_pushPointer(L, (void *) method); lua_pushcclosure(L, closure, 1); return 1; break; default: return method(lua_obj, L); break; } }
void tLuaCOMConnPoint::push() { LUASTACK_SET(L); lua_newtable(L); luaCompat_pushTypeByName(L, MODULENAME, LCOM_CONNPOINT_TYPENAME); luaCompat_setType(L, -2); lua_pushstring(L, CONNPOINT_NAME); luaCompat_pushPointer(L, this); lua_settable(L, -3); LUASTACK_CLEAN(L, 1); }