Merge pull request #6188 from cjshmyr/luaparse
Log reason why a Lua script fails to parse
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -162,6 +163,7 @@ namespace OpenRA.Scripting
|
|||||||
public void FatalError(string message)
|
public void FatalError(string message)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Fatal Lua Error: {0}", message);
|
Console.WriteLine("Fatal Lua Error: {0}", message);
|
||||||
|
Game.AddChatLine(Color.White, "Fatal Lua Error", message);
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ Tick = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
ExecuteSandboxedScript = function(file, contents)
|
ExecuteSandboxedScript = function(file, contents)
|
||||||
local script = loadstring(contents, file)
|
local script, err = loadstring(contents, file)
|
||||||
if (script == nil) then
|
if (script == nil) then
|
||||||
FatalError("Error parsing " .. file)
|
FatalError("Error parsing " .. file .. ". Reason: " .. err)
|
||||||
else
|
else
|
||||||
TryRunSandboxed(script)
|
TryRunSandboxed(script)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user