Script: Add default value support for SKIN:GetVariable

This commit is contained in:
Birunthan Mohanathas 2013-09-19 17:16:26 +03:00
parent 5fd98509cf
commit 7558666b13

View File

@ -104,13 +104,17 @@ static int GetMeasure(lua_State* L)
static int GetVariable(lua_State* L) static int GetVariable(lua_State* L)
{ {
DECLARE_SELF(L) DECLARE_SELF(L)
std::wstring strTmp = LuaManager::ToWide(2);
const std::wstring* value = self->GetParser().GetVariable(strTmp); const std::wstring name = LuaManager::ToWide(2);
const std::wstring* value = self->GetParser().GetVariable(name);
if (value) if (value)
{ {
LuaManager::PushWide(*value); LuaManager::PushWide(*value);
} }
else if (lua_gettop(L) >= 3)
{
lua_pushvalue(L, 3);
}
else else
{ {
lua_pushnil(L); lua_pushnil(L);