本文整理汇总了C++中SpaceStation::RemoveBBAdvert方法的典型用法代码示例。如果您正苦于以下问题:C++ SpaceStation::RemoveBBAdvert方法的具体用法?C++ SpaceStation::RemoveBBAdvert怎么用?C++ SpaceStation::RemoveBBAdvert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpaceStation
的用法示例。
在下文中一共展示了SpaceStation::RemoveBBAdvert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: l_spacestation_remove_advert
/*
* Method: RemoveAdvert
*
* Remove an advertisement from the station's bulletin board
*
* > station:RemoveAdvert(ref)
*
* If the deletefunc parameter was supplied to <AddAdvert> when the ad was
* created, it will be called as part of this call.
*
* Parameters:
*
* ref - the advert reference number returned by <AddAdvert>
*
* Availability:
*
* alpha 10
*
* Status:
*
* stable
*/
static int l_spacestation_remove_advert(lua_State *l)
{
LUA_DEBUG_START(l);
SpaceStation *s = LuaSpaceStation::GetFromLua(1);
int ref = luaL_checkinteger(l, 2);
if (!s->RemoveBBAdvert(ref))
return 0;
lua_getfield(l, LUA_REGISTRYINDEX, "PiAdverts");
if (lua_isnil(l, -1)) {
lua_pop(l, 1);
return 0;
}
lua_pushinteger(l, ref);
lua_gettable(l, -2);
if (lua_isnil(l, -1)) {
lua_pop(l, 2);
return 0;
}
lua_getfield(l, -1, "onDelete");
if (lua_isnil(l, -1))
lua_pop(l, 1);
else {
lua_pushinteger(l, ref);
pi_lua_protected_call(l, 1, 0);
}
lua_pop(l, 1);
lua_pushinteger(l, ref);
lua_pushnil(l);
lua_settable(l, -3);
lua_pop(l, 1);
LUA_DEBUG_END(l,0);
return 0;
}