Beispiel #1
0
        /*
         * Sets a field of the table or userdata corresponding the the provided reference
         * to the provided value
         */
        internal void setObject(int reference, string field, object val)
        {
            int oldTop = LuaLib.lua_gettop(luaState);

            LuaLib.lua_getref(luaState, reference);
            setObject(field.Split(new char[] { '.' }), val);
            LuaLib.lua_settop(luaState, oldTop);
        }
Beispiel #2
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.lua_gettop(luaState);

            LuaLib.lua_getref(luaState, reference);
            translator.push(luaState, field);
            translator.push(luaState, val);
            LuaLib.lua_settable(luaState, -3);
            LuaLib.lua_settop(luaState, oldTop);
        }
Beispiel #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.lua_gettop(luaState);

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

            LuaLib.lua_settop(luaState, oldTop);
            return(returnValue);
        }
Beispiel #4
0
 /*
  * Pushes the function into the Lua stack
  */
 internal void push(LuaCore.lua_State luaState)
 {
     if (_Reference != 0)
     {
         LuaLib.lua_getref(luaState, _Reference);
     }
     else
     {
         _Interpreter.pushCSFunction(function);
     }
 }
Beispiel #5
0
        /*
         * Compares the two values referenced by ref1 and ref2 for equality
         */
        internal bool compareRef(int ref1, int ref2)
        {
            int top = LuaLib.lua_gettop(luaState);

            LuaLib.lua_getref(luaState, ref1);
            LuaLib.lua_getref(luaState, ref2);
            int equal = LuaLib.lua_equal(luaState, -1, -2);

            LuaLib.lua_settop(luaState, top);
            return(equal != 0);
        }
Beispiel #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.lua_gettop(luaState);

            LuaLib.lua_getref(luaState, reference);
            translator.push(luaState, field);
            LuaLib.lua_gettable(luaState, -2);
            object returnValue = translator.getObject(luaState, -1);

            LuaLib.lua_settop(luaState, oldTop);
            return(returnValue);
        }
Beispiel #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.lua_gettop(luaState);

            LuaLib.lua_getref(luaState, reference);
            LuaLib.lua_pushstring(luaState, field);
            LuaLib.lua_rawget(luaState, -2);
            object obj = translator.getObject(luaState, -1);

            LuaLib.lua_settop(luaState, oldTop);
            return(obj);
        }
Beispiel #8
0
 /*
  * Pushes this table into the Lua stack
  */
 internal void push(LuaCore.lua_State luaState)
 {
     LuaLib.lua_getref(luaState, _Reference);
 }