From 6079c7d0d9a386a79622a78c347aae86aebc4f4a Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Fri, 17 Aug 2012 19:11:34 +0300 Subject: [PATCH] Script: Fixed backwards compatibility issues due to removed tolua.cast --- Library/lua/glue/LuaGlobal.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Library/lua/glue/LuaGlobal.cpp b/Library/lua/glue/LuaGlobal.cpp index 26f54d8b..df70f0f5 100644 --- a/Library/lua/glue/LuaGlobal.cpp +++ b/Library/lua/glue/LuaGlobal.cpp @@ -57,7 +57,23 @@ static int Print(lua_State* L) return 0; } +static int tolua_cast(lua_State* L) +{ + // Simply push first argument onto stack. + lua_pushvalue(L, 1); + return 1; +} + void LuaManager::RegisterGlobal(lua_State* L) { lua_register(L, "print", Print); + + // Register tolua.cast() for backwards compatibility. + const luaL_Reg toluaFuncs[] = + { + { "cast", tolua_cast }, + { NULL, NULL } + }; + + luaL_register(L, "tolua", toluaFuncs); }