/// <summary> /// Creates a read-only copy of the given settings. /// </summary> /// <param name="copy">The settings to copy.</param> LuaSettings(LuaSettings copy) { _readonly = true; _onquit = copy._onquit; _name = copy._name; _libs = copy._libs; _access = _checkAccess(copy._access); _enc = copy._enc ?? Encoding.UTF8; _nonSeek = copy._nonSeek; _reflect = copy._reflect; _ensureReturn = copy._ensureReturn; _in = copy._in; _out = copy._out; }
/// <summary> /// Creates a read-only copy of the given settings. /// </summary> /// <param name="copy">The settings to copy.</param> LuaSettings(LuaSettings copy) { this._readonly = true; this._onquit = copy._onquit; this._name = copy._name; this._libs = copy._libs; this._access = CheckAccess(copy._access); this._enc = copy._enc ?? Encoding.UTF8; this._nonSeek = copy._nonSeek; this._reflect = copy._reflect; this._ensureReturn = copy._ensureReturn; this._in = copy._in; this._out = copy._out; }
/// <summary> /// Gets a variables from a given Lua file using the default environment and the given settings. /// </summary> /// <param name="settings">The settings used to load the chunk.</param> /// <param name="path">The path to the Lua file.</param> /// <param name="names">The names of the variable to get.</param> /// <returns>The values of the variables or null if not found. The array is /// never null.</returns> /// <exception cref="System.ArgumentException">If path is not in the /// correct format -or- if names contains a null string.</exception> /// <exception cref="System.ArgumentNullException">If any arguments are null.</exception> /// <exception cref="System.IO.FileNotFoundException">If the given file /// could not be found.</exception> /// <exception cref="System.InvalidCastException">If one of the variables /// could not be converted to the given type.</exception> /// <exception cref="ModMaker.Lua.Parser.SyntaxException">If there are /// syntax errors in the file.</exception> public static T[] GetVariables <T>(LuaSettings settings, string path, params string[] names) { return(GetVariables <T>(new LuaEnvironmentNet(settings), path, names)); }
/// <summary> /// Gets a variable from a given Lua file using the default environment with the given settings. /// </summary> /// <param name="settings">The settings used to load the chunk.</param> /// <param name="path">The path to the Lua file.</param> /// <param name="name">The name of the variable to get.</param> /// <returns>The value of the variable or null if not found.</returns> /// <exception cref="System.ArgumentException">If path is not in the /// correct format.</exception> /// <exception cref="System.ArgumentNullException">If any arguments are null.</exception> /// <exception cref="System.IO.FileNotFoundException">If the given file /// could not be found.</exception> /// <exception cref="System.InvalidCastException">If the variable /// could not be converted to the given type.</exception> /// <exception cref="ModMaker.Lua.Parser.SyntaxException">If there are /// syntax errors in the file.</exception> public static T GetVariable <T>(LuaSettings settings, string path, string name) { return(GetVariables <T>(new LuaEnvironmentNet(settings), path, new[] { name })[0]); }
/// <summary> /// Creates a new Lua object using the default environment, runtime, and compiler using the /// given settings. /// </summary> /// <param name="settings">The settings to use, cannot be null.</param> /// <exception cref="System.ArgumentNullException">If settings is null.</exception> public Lua(LuaSettings settings) : this(new LuaEnvironmentNet(settings)) { }