bool LuaObjectBase::checkValidity(lua_State* state, int position, bool error) { #ifdef FULL_USER_DATA // Make sure it's some user data! int type = LUA->GetType(position); if(type != GarrysMod::Lua::Type::USERDATA && type <= GarrysMod::Lua::Type::COUNT) { if (error) { LUA->ThrowError( "Invalid object! (not userdata)\n" ); } return 0; } // Acually do the check GarrysMod::Lua::UserData* obj = (GarrysMod::Lua::UserData*)LUA->GetUserdata(position); LuaObjectBase* object = (LuaObjectBase*)(obj->data); #else ILuaObject* table = luaInterface->GetObject(position); if (!table) return 0; LuaObjectBase* object = reinterpret_cast<LuaObjectBase*>( table->GetMemberUserDataLite("_this") ); int type = 0; table->UnReference(); #endif return checkValidity(state, type, object, error); }
SyncList<streamProcData *>* GetPendingChannels( ILuaInterface *gLua ) { ILuaObject* bass = gLua->GetGlobal( "BASS" ); if (!bass) return NULL; SyncList<streamProcData *>* pData = (SyncList<streamProcData *>*)bass->GetMemberUserDataLite( "p_PendingChannels" ); return pData; }