int lua_TextureSampler_getTexture(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { Texture::Sampler* instance = getInstance(state); void* returnPtr = (void*)instance->getTexture(); if (returnPtr) { ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Texture"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } else { lua_pushstring(state, "lua_TextureSampler_getTexture - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; }
Texture* ParticleEmitter::getTexture() const { Texture::Sampler* sampler = _spriteBatch ? _spriteBatch->getSampler() : NULL; return sampler? sampler->getTexture() : NULL; }