From 9ea18abb49a760fe1eda197c02cbdcd680b47204 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 22 Aug 2010 13:32:24 +0200 Subject: Pass a script name to Lua for proper reporting of error locations Now the Lua file name shows up in the error message and stack traceback, or the map file and object name in case of a script embedded in a map file. --- src/scripting/luascript.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/scripting/luascript.cpp') diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp index ee727060..23e4fdb9 100644 --- a/src/scripting/luascript.cpp +++ b/src/scripting/luascript.cpp @@ -19,14 +19,14 @@ * along with The Mana Server. If not, see . */ -#include - #include "luascript.hpp" #include "game-server/being.hpp" - #include "utils/logger.h" +#include +#include + LuaScript::~LuaScript() { lua_close(mState); @@ -83,9 +83,9 @@ int LuaScript::execute() mCurFunction = ""; } -void LuaScript::load(const char *prog) +void LuaScript::load(const char *prog, const char *name) { - int res = luaL_loadstring(mState, prog); + int res = luaL_loadbuffer(mState, prog, std::strlen(prog), name); if (res) { switch (res) { -- cgit v1.2.3-70-g09d2