Exemplo n.º 1
0
        private LuaResult LuaRequire(object modname)
        {
            if (modname == null)
            {
                throw new ArgumentNullException();
            }

            // check if the modul is loaded in this global
            if (loaded.ContainsKey(modname))
            {
                return(new LuaResult(loaded[modname]));
            }

            // check if the modul is loaded in a different global
            LuaChunk chunk = lua.LuaRequire(this, modname);

            if (chunk != null)
            {
                return(new LuaResult(loaded[modname] = DoChunk(chunk)[0]));
            }
            else
            {
                return(LuaResult.Empty);
            }
        }         // func LuaRequire