From 05bb880a3b0ebe401bac83b7a2400aa315161f9c Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Mon, 27 Feb 2012 23:28:45 +0100 Subject: Simplified some of the Lua backend Mainly introduced a helper function for getting to the Script instance for the current Lua state. Reviewed-by: Erik Schilling Reviewed-by: Yohann Ferreira --- src/scripting/lua.cpp | 96 ++++++++++++++------------------------------- src/scripting/luascript.cpp | 4 +- 2 files changed, 30 insertions(+), 70 deletions(-) (limited to 'src/scripting') diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index b9c76c2..9aec6b3 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -63,6 +63,16 @@ extern "C" { * http://doc.manasource.org/scripting */ +static Script *getScript(lua_State *s) +{ + lua_pushlightuserdata(s, (void *)®istryKey); + lua_gettable(s, LUA_REGISTRYINDEX); + Script *script = static_cast