Beispiel #1
0
        // -- Static --------------------------------------------------------------

        /// <summary>Get the LuaStackFrame from a .net StackFrame, if someone exists. In the other case, the return LuaStackFrame is only proxy to the orginal frame.</summary>
        /// <param name="frame">.net stackframe</param>
        /// <returns>LuaStackFrame</returns>
        public static LuaStackFrame GetStackFrame(StackFrame frame)
        {
            ILuaDebugInfo info = null;

            // find the lua debug info
            var method = frame.GetMethod();
            var chunk  = Lua.GetChunkFromMethodInfo(method);

            if (chunk != null)
            {
                info = chunk.GetDebugInfo(method, frame.GetILOffset());
            }

            return(new LuaStackFrame(frame, info));
        }         // func GetStackFrame