/** * \brief Implementation of drawable:get_movement(). * \param l The Lua context that is calling this function. * \return Number of values to return to Lua. */ int LuaContext::drawable_api_get_movement(lua_State* l) { Drawable& drawable = check_drawable(l, 1); Movement* movement = drawable.get_movement(); if (movement == NULL) { lua_pushnil(l); } else { push_userdata(l, *movement); } return 1; }
/** * \brief Pushes a timer userdata onto the stack. * \param l A Lua context. * \param Timer A timer. */ void LuaContext::push_timer(lua_State* l, const TimerPtr& timer) { push_userdata(l, *timer); }
/** * \brief Pushes a timer userdata onto the stack. * \param l a Lua context * \param timer a timer */ void LuaContext::push_timer(lua_State* l, Timer& timer) { push_userdata(l, timer); }
/** * \brief Pushes a text surface userdata onto the stack. * \param l a Lua context * \param text_surface a text surface */ void LuaContext::push_text_surface(lua_State* l, TextSurface& text_surface) { push_userdata(l, text_surface); }
/** * \brief Pushes a surface userdata onto the stack. * \param l a Lua context * \param surface a surface */ void LuaContext::push_surface(lua_State* l, Surface& surface) { push_userdata(l, surface); }
/** * \brief Pushes an equipment item userdata onto the stack. * \param l A Lua context. * \param item An item. */ void LuaContext::push_item(lua_State* l, EquipmentItem& item) { push_userdata(l, item); }
/** * \brief Pushes a game userdata onto the stack. * \param l A Lua context. * \param game A game. */ void LuaContext::push_game(lua_State* l, Savegame& game) { push_userdata(l, game); }
/** * \brief Pushes a sprite userdata onto the stack. * \param l a Lua context * \param sprite a sprite */ void LuaContext::push_sprite(lua_State* l, Sprite& sprite) { sprite.set_lua_context(&get_lua_context(l)); // To make callbacks work. push_userdata(l, sprite); }