public void LoadScriptFile(string scriptFile, string scriptName = null) { if (ScriptStandard != null) { ScriptStandard.Scrub(Lua, scriptContainer); } scriptContainer.ResetHooks(); Lua.DoFile(scriptFile, null, scriptName); if (ScriptStandard != null) { List <string> errors = new List <string>(); bool res = ScriptStandard.ApplyStandard(Lua, scriptContainer, errors); if (!res) { //Todo: new type of exception with info throw new Exception($"Script Standard was not met! Standards Not Met: [{string.Join(", ", errors)}]"); } } }
public void LoadScript(string scriptString, string scriptName = "User Code") { //Remove old hooks so they aren't counted if (ScriptStandard != null) { ScriptStandard.Scrub(Lua, scriptContainer); } scriptContainer.ResetHooks(); Lua.DoString(scriptString, null, scriptName); if (ScriptStandard != null) { List <string> errors = new List <string>(); bool res = ScriptStandard.ApplyStandard(Lua, scriptContainer, errors); if (!res) { //Todo: new type of exception with info throw new Exception($"Script Standard was not met! Standards Not Met: [{string.Join(", ", errors)}]"); } } }