Пример #1
0
        /// <summary>
        /// Gets the stack entry on a given level
        /// </summary>
        /// <param name = "level">level</param>
        /// <param name = "luaDebug">lua debug structure</param>
        /// <returns>Returns true if level was allowed, false if level was invalid.</returns>
        /// <author>Reinhard Ostermeier</author>

        /*public bool GetStack(int level, out LuaCore.lua_Debug luaDebug)
         * {
         *      luaDebug = new LuaDebug();
         *      LuaCore.lua_State ld = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(luaDebug));
         *      System.Runtime.InteropServices.Marshal.StructureToPtr(luaDebug, ld, false);
         *      try
         *      {
         *              return LuaLib.lua_getstack(luaState, level, luaDebug) != 0;
         *      }
         *      finally
         *      {
         *              luaDebug = (LuaDebug)System.Runtime.InteropServices.Marshal.PtrToStructure(ld, typeof(LuaDebug));
         *              System.Runtime.InteropServices.Marshal.FreeHGlobal(ld);
         *      }
         * }*/

        /// <summary>
        /// Gets info (see lua docs)
        /// </summary>
        /// <param name = "what">what (see lua docs)</param>
        /// <param name = "luaDebug">lua debug structure</param>
        /// <returns>see lua docs</returns>
        /// <author>Reinhard Ostermeier</author>

        /*public int GetInfo(String what, ref LuaCore.lua_Debug luaDebug)
         * {
         *      LuaCore.lua_State ld = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(luaDebug));
         *      System.Runtime.InteropServices.Marshal.StructureToPtr(luaDebug, ld, false);
         *      try
         *      {
         *              return LuaLib.lua_getinfo(luaState, what, ld);
         *      }
         *      finally
         *      {
         *              luaDebug = (LuaDebug)System.Runtime.InteropServices.Marshal.PtrToStructure(ld, typeof(LuaDebug));
         *              System.Runtime.InteropServices.Marshal.FreeHGlobal(ld);
         *      }
         * }*/

        /// <summary>
        /// Gets local (see lua docs)
        /// </summary>
        /// <param name = "luaDebug">lua debug structure</param>
        /// <param name = "n">see lua docs</param>
        /// <returns>see lua docs</returns>
        /// <author>Reinhard Ostermeier</author>
        public string GetLocal(LuaCore.lua_Debug luaDebug, int n)
        {
            return(LuaCore.lua_getlocal(luaState, luaDebug, n).ToString());
        }