/// <summary> /// Does simple syntax checking of a LUA plugin. NOTE: Doe not find runtime errors! /// </summary> /// <param name="code">Code to compile</param> /// <param name="suppressExceptions">Set to false if you would like to see /// the exception thrown, good for debugging</param> /// <returns>True if compiling to bytecode is successful</returns> public static Boolean canCompile(String code, Boolean suppressExceptions = true) { Lua tempLua = null; try { tempLua = new Lua(); tempLua.LoadString(code, "CompileCheck"); } catch (Exception ex) { if (suppressExceptions) return false; else throw ex; } finally { if (tempLua != null) tempLua.Close(); } return true; }
/// <summary> /// /// </summary> /// <param name="chunk"></param> /// <param name="func"></param> /// <returns></returns> public object[] DoStringWithLoad(string chunk, string func) { var luaFunc = _lua.LoadString(chunk, func); return(luaFunc.Call(null)); }