示例#1
0
        /*
         * Sets a numeric field of the table or userdata corresponding the the provided reference
         * to the provided value
         */
        internal void SetObject(int reference, object field, object val)
        {
            int oldTop = LuaLib.LuaGetTop(luaState);

            LuaLib.LuaGetRef(luaState, reference);
            translator.Push(luaState, field);
            translator.Push(luaState, val);
            LuaLib.LuaSetTable(luaState, -3);
            LuaLib.LuaSetTop(luaState, oldTop);
        }
示例#2
0
        /*
         * Gets a field of the table or userdata corresponding to the provided reference
         */
        internal object GetObject(int reference, string field)
        {
            int oldTop = LuaLib.LuaGetTop(luaState);

            LuaLib.LuaGetRef(luaState, reference);
            object returnValue = GetObject(FullPathToArray(field));

            LuaLib.LuaSetTop(luaState, oldTop);
            return(returnValue);
        }
示例#3
0
        /*
         * Gets a field of the table or userdata corresponding to the provided reference
         */
        internal object GetObject(int reference, string field)
        {
            int oldTop = LuaLib.LuaGetTop(luaState);

            LuaLib.LuaGetRef(luaState, reference);
            object returnValue = GetObject(field.Split(new char[] { '.' }));

            LuaLib.LuaSetTop(luaState, oldTop);
            return(returnValue);
        }
示例#4
0
        /*
         * Compares the two values referenced by ref1 and ref2 for equality
         */
        internal bool CompareRef(int ref1, int ref2)
        {
            int top = LuaLib.LuaGetTop(luaState);

            LuaLib.LuaGetRef(luaState, ref1);
            LuaLib.LuaGetRef(luaState, ref2);
            int equal = LuaLib.LuaEqual(luaState, -1, -2);

            LuaLib.LuaSetTop(luaState, top);
            return(equal != 0);
        }
示例#5
0
 /*
  * Pushes the function into the Lua stack
  */
 internal void Push(LuaState luaState)
 {
     if (_Reference != 0)
     {
         LuaLib.LuaGetRef(luaState, _Reference);
     }
     else
     {
         _Interpreter.PushCSFunction(function);
     }
 }
示例#6
0
        /*
         * Gets a numeric field of the table or userdata corresponding the the provided reference
         */
        internal object GetObject(int reference, object field)
        {
            int oldTop = LuaLib.LuaGetTop(luaState);

            LuaLib.LuaGetRef(luaState, reference);
            translator.Push(luaState, field);
            LuaLib.LuaGetTable(luaState, -2);
            object returnValue = translator.GetObject(luaState, -1);

            LuaLib.LuaSetTop(luaState, oldTop);
            return(returnValue);
        }
示例#7
0
        /*
         * Gets a field of the table corresponding to the provided reference
         * using rawget (do not use metatables)
         */
        internal object RawGetObject(int reference, string field)
        {
            int oldTop = LuaLib.LuaGetTop(luaState);

            LuaLib.LuaGetRef(luaState, reference);
            LuaLib.LuaPushString(luaState, field);
            LuaLib.LuaRawGet(luaState, -2);
            object obj = translator.GetObject(luaState, -1);

            LuaLib.LuaSetTop(luaState, oldTop);
            return(obj);
        }
示例#8
0
 /*
  * Pushes this table into the Lua stack
  */
 internal void Push(LuaState luaState)
 {
     LuaLib.LuaGetRef(luaState, _Reference);
 }