mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 08:18:09 +00:00
Split code a bit.
This commit is contained in:
parent
a0cc796cfa
commit
5fd50fea13
@ -113,6 +113,17 @@ static void chat_message(std::string const &caption, std::string const &msg)
|
|||||||
events::chat_handler::MESSAGE_PUBLIC, false);
|
events::chat_handler::MESSAGE_PUBLIC, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pushes a config as a volatile vconfig on the top of the stack.
|
||||||
|
*/
|
||||||
|
static void luaW_pushvconfig(lua_State *L, config const &cfg)
|
||||||
|
{
|
||||||
|
new(lua_newuserdata(L, sizeof(vconfig))) vconfig(cfg, true);
|
||||||
|
lua_pushlightuserdata(L, (void *)&vconfigKey);
|
||||||
|
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||||
|
lua_setmetatable(L, -2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes a t_string on the top of the stack.
|
* Pushes a t_string on the top of the stack.
|
||||||
*/
|
*/
|
||||||
@ -966,10 +977,7 @@ static int cfun_wml_action_proxy(lua_State *L)
|
|||||||
config cfg;
|
config cfg;
|
||||||
if (!luaW_toconfig(L, 1, cfg))
|
if (!luaW_toconfig(L, 1, cfg))
|
||||||
goto error_call_destructors;
|
goto error_call_destructors;
|
||||||
new(lua_newuserdata(L, sizeof(vconfig))) vconfig(cfg, true);
|
luaW_pushvconfig(L, cfg);
|
||||||
lua_pushlightuserdata(L, (void *)&vconfigKey);
|
|
||||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
|
||||||
lua_setmetatable(L, -2);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LUA_TUSERDATA:
|
case LUA_TUSERDATA:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user