From f08b62e1a0b9719bb03fd0db89353f69f0680def Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 3 Mar 2012 22:58:34 +0100 Subject: Removed the last direct call to global script function The ScriptAction of the TriggerArea (which can be created by mana.trigger_create) was still using a named global function for its callback. Now it also uses a reference to a script function. Since it was the last occurrence of a call to a global script function, I've also removed the Script::prepare(std::string) overload. Reviewed-by: Erik Schilling Mantis-issue: 299 --- src/scripting/luascript.cpp | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/scripting/luascript.cpp') diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp index 27361579..231dece1 100644 --- a/src/scripting/luascript.cpp +++ b/src/scripting/luascript.cpp @@ -47,15 +47,6 @@ void LuaScript::prepare(Ref function) lua_rawgeti(mState, LUA_REGISTRYINDEX, function.value); assert(lua_isfunction(mState, -1)); nbArgs = 0; - mCurFunction = ""; // We don't know the function name -} - -void LuaScript::prepare(const std::string &name) -{ - assert(nbArgs == -1); - lua_getglobal(mState, name.c_str()); - nbArgs = 0; - mCurFunction = name; } void LuaScript::push(int v) @@ -112,7 +103,6 @@ int LuaScript::execute() LOG_WARN("Lua Script Error" << std::endl << " Script : " << mScriptFile << std::endl - << " Function: " << mCurFunction << std::endl << " Error : " << (s ? s : "") << std::endl); lua_pop(mState, 1); return 0; @@ -120,7 +110,6 @@ int LuaScript::execute() res = lua_tointeger(mState, -1); lua_pop(mState, 1); return res; - mCurFunction.clear(); } void LuaScript::assignCallback(Script::Ref &function) -- cgit v1.2.3-70-g09d2