Пример #1
0
        /// <summary>
        /// Gets the _ENV upvalue of a function
        /// </summary>
        /// <param name="func">Target function</param>
        /// <returns></returns>
        internal object GetFunctionEnv(object func)
        {
            int nArgs  = 0;
            int oldTop = LuaLib.LuaGetTop(luaState);

            translator.Push(luaState, func);

            //                      func index  upvalue (_ENV = 1)
            //                               V  V
            LuaCore.LuaGetUpValue(luaState, -1, 1);

            return(translator.PopValues(luaState, oldTop));
        }
Пример #2
0
 /// <summary>
 /// Gets up value (see lua docs)
 /// </summary>
 /// <param name = "funcindex">see lua docs</param>
 /// <param name = "n">see lua docs</param>
 /// <returns>see lua docs</returns>
 public string GetUpValue(int funcindex, int n)
 {
     return(LuaCore.LuaGetUpValue(luaState, funcindex, n).ToString());
 }