Example #1
0
 /// <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;
 }
Example #2
0
 /// <summary>
 /// Creates a new instance of LuaSettings with the default values that uses the given streams
 /// for input.
 /// </summary>
 /// <param name="stdin">The standard input stream.</param>
 /// <param name="stdout">The standard output stream.</param>
 public LuaSettings(Stream stdin, Stream stdout)
 {
     _readonly     = false;
     _onquit       = null;
     _name         = null;
     _libs         = LuaLibraries.All;
     _access       = LuaClassAccess.Registered;
     _enc          = null;
     _nonSeek      = false;
     _reflect      = false;
     _ensureReturn = false;
     _in           = stdin;
     _out          = stdout;
 }
Example #3
0
        /// <summary>
        /// Ensures that the LuaClassAccess is realy one of the enumerated values.
        /// If it is invalid, it will use the default (Registered).
        /// </summary>
        /// <param name="access">The value to check.</param>
        /// <returns>A valid LuaClassAccess choice.</returns>
        static LuaClassAccess CheckAccess(LuaClassAccess access)
        {
            switch (access)
            {
            case LuaClassAccess.System:
                return(LuaClassAccess.System);

            case LuaClassAccess.All:
                return(LuaClassAccess.All);

            default:
                return(LuaClassAccess.Registered);
            }
        }
Example #4
0
        /// <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;
        }
Example #5
0
 /// <summary>
 /// Ensures that the LuaClassAccess is realy one of the enumerated values.
 /// If it is invalid, it will use the default (Registered).
 /// </summary>
 /// <param name="access">The value to check.</param>
 /// <returns>A valid LuaClassAccess choice.</returns>
 static LuaClassAccess CheckAccess(LuaClassAccess access)
 {
     switch (access)
     {
         case LuaClassAccess.System:
             return LuaClassAccess.System;
         case LuaClassAccess.All:
             return LuaClassAccess.All;
         default:
             return LuaClassAccess.Registered;
     }
 }
Example #6
0
        /// <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;
        }
Example #7
0
        /// <summary>
        /// Creates a new instance of LuaSettings with the default values that
        /// uses the given streams for input.
        /// </summary>
        /// <param name="stdin">The standard input stream.</param>
        /// <param name="stdout">The standard output stream.</param>
        public LuaSettings(Stream stdin, Stream stdout)
        {
            this._readonly = false;

            this._onquit = null;
            this._name = null;
            this._libs = LuaLibraries.All;
            this._access = LuaClassAccess.Registered;
            this._enc = null;
            this._nonSeek = false;
            this._reflect = false;
            this._ensureReturn = false;
            this._in = stdin;
            this._out = stdout;
        }