luaL_loadfile() private method

private luaL_loadfile ( IntPtr luaState, string filename ) : int
luaState System.IntPtr
filename string
return int
示例#1
0
        /*
         * Excutes a Lua file and returns all the chunk's return
         * values in an array
         */
        public object[] DoFile(string fileName)
        {
            int oldTop = LuaDLL.lua_gettop(luaState);

            if (LuaDLL.luaL_loadfile(luaState, fileName) == 0)
            {
                executing = true;
                try
                {
                    if (LuaDLL.lua_pcall(luaState, 0, -1, 0) == 0)
                    {
                        return(translator.popValues(luaState, oldTop));
                    }
                    else
                    {
                        ThrowExceptionFromError(oldTop);
                    }
                }
                finally { executing = false; }
            }
            else
            {
                ThrowExceptionFromError(oldTop);
            }

            return(null);            // Never reached - keeps compiler happy
        }
示例#2
0
		// steffenj: END Lua 5.1.1 API change (lua_newtable is gone, lua_createtable is new)
		// steffenj: BEGIN Lua 5.1.1 API change (lua_dofile now in LuaLib as luaL_dofile macro)
		//[DllImport(LUALIBDLL, CallingConvention = CallingConvention.Cdecl)]
		public static int luaL_dofile(IntPtr luaState, string fileName)
		{
			int result = LuaDLL.luaL_loadfile(luaState, fileName);
			if (result != 0)
				return result;

			return LuaDLL.lua_pcall(luaState, 0, -1, 0);
		}
示例#3
0
        public static int luaL_dofile(IntPtr luaState, string fileName)
        {
            int num = LuaDLL.luaL_loadfile(luaState, fileName);

            if (num != 0)
            {
                return(num);
            }
            return(LuaDLL.lua_pcall(luaState, 0, LuaDLL.LUA_MULTRET, 0));
        }
示例#4
0
        public static int luaL_dofile(IntPtr luaState, string fileName)
        {
            int result = LuaDLL.luaL_loadfile(luaState, fileName);

            if (result != 0)
            {
                return(result);
            }

            return(LuaDLL.lua_pcall(luaState, 0, LUA_MULTRET, 0));
        }
示例#5
0
        public static int luaL_dofile(IntPtr luaState, string chunk)
        {
            int result = LuaDLL.luaL_loadfile(luaState, chunk);

            if (result != 0)
            {
                return(result);
            }

            return(LuaDLL.lua_pcall(luaState, 0, -1, 0));
        }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public LuaFunction LoadFile(string fileName)
        {
            int oldTop = LuaDLL.lua_gettop(luaState);

            if (LuaDLL.luaL_loadfile(luaState, fileName) != 0)
            {
                ThrowExceptionFromError(oldTop);
            }

            LuaFunction result = translator.getFunction(luaState, -1);

            translator.popValues(luaState, oldTop);

            return(result);
        }
示例#7
0
        public static bool luaL_dofile(IntPtr luaState, string fileName)
        {
            int num = LuaDLL.luaL_loadfile(luaState, fileName);

            return(num == 0 && LuaDLL.lua_pcall(luaState, 0, LuaDLL.LUA_MULTRET, 0) == 0);
        }