Split code a bit.

This commit is contained in:
Guillaume Melquiond 2009-11-01 11:05:27 +00:00
parent a0cc796cfa
commit 5fd50fea13

View File

@ -113,6 +113,17 @@ static void chat_message(std::string const &caption, std::string const &msg)
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.
*/
@ -966,10 +977,7 @@ static int cfun_wml_action_proxy(lua_State *L)
config cfg;
if (!luaW_toconfig(L, 1, cfg))
goto error_call_destructors;
new(lua_newuserdata(L, sizeof(vconfig))) vconfig(cfg, true);
lua_pushlightuserdata(L, (void *)&vconfigKey);
lua_rawget(L, LUA_REGISTRYINDEX);
lua_setmetatable(L, -2);
luaW_pushvconfig(L, cfg);
break;
}
case LUA_TUSERDATA: