Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
        public static void Initialize(ILuaEnvironment env)
        {
            LuaLibraries libraries = env.Settings.Libraries;

            if ((libraries & LuaLibraries.Standard) == LuaLibraries.Standard)
            {
                Standard.Initialize(env);
            }
            if ((libraries & LuaLibraries.IO) == LuaLibraries.IO)
            {
                IO.Initialize(env);
            }
            if ((libraries & LuaLibraries.String) == LuaLibraries.String)
            {
                String.Initialize(env);
            }
            if ((libraries & LuaLibraries.Math) == LuaLibraries.Math)
            {
                Math.Initialize(env);
                Bit32.Initialize(env);
            }
            if ((libraries & LuaLibraries.Table) == LuaLibraries.Table)
            {
                new Table(env).Initialize();
            }
            if ((libraries & LuaLibraries.OS) == LuaLibraries.OS)
            {
                new OS(env).Initialize();
            }
            if ((libraries & LuaLibraries.Modules) == LuaLibraries.Modules)
            {
                new Module(env).Initialize();
            }
            if ((libraries & LuaLibraries.Coroutine) == LuaLibraries.Coroutine)
            {
                new Coroutine(env).Initialize();
            }
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
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;
        }