From 7558666b13c2342ccf2c5e20b7e39a03c0470f66 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 19 Sep 2013 17:16:26 +0300 Subject: [PATCH] Script: Add default value support for SKIN:GetVariable --- Library/lua/glue/LuaMeterWindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Library/lua/glue/LuaMeterWindow.cpp b/Library/lua/glue/LuaMeterWindow.cpp index a439e33f..8a52873b 100644 --- a/Library/lua/glue/LuaMeterWindow.cpp +++ b/Library/lua/glue/LuaMeterWindow.cpp @@ -104,13 +104,17 @@ static int GetMeasure(lua_State* L) static int GetVariable(lua_State* 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) { LuaManager::PushWide(*value); } + else if (lua_gettop(L) >= 3) + { + lua_pushvalue(L, 3); + } else { lua_pushnil(L);