lua_newtable() public static method

public static lua_newtable ( IntPtr luaState ) : void
luaState System.IntPtr
return void
Esempio n. 1
0
 public static void PushDictionary(this IntPtr L, Dictionary <string, double> dict)
 {
     Lua.lua_newtable(L);
     foreach (var pair in dict)
     {
         Push(L, pair.Value);
         Lua.lua_setfield(L, -2, pair.Key);
     }
 }
Esempio n. 2
0
        public static void PushList(this IntPtr L, IEnumerable <double> list)
        {
            Lua.lua_newtable(L);
            int i = 1;

            foreach (var v in list)
            {
                Push(L, v);
                Lua.lua_rawseti(L, -2, i++);
            }
        }
Esempio n. 3
0
        public static void PushXLObjectList(this IntPtr L, string typeName, IEnumerable <int> handles)
        {
            Lua.lua_newtable(L);
            int i = 1;

            foreach (var handle in handles)
            {
                XLLuaRuntime.XLLRT_PushXLObject(L, typeName, new IntPtr(handle));
                Lua.lua_rawseti(L, -2, i++);
            }
        }
Esempio n. 4
0
        public static void PushDictionary(this IntPtr L, Dictionary <string, string> dict)
        {
            Lua.lua_newtable(L);
            foreach (var pair in dict)
            {
                if (pair.Value != null)
                {
                    Push(L, pair.Value);
                }
                else
                {
                    L.PushNull();
                }

                Lua.lua_setfield(L, -2, pair.Key);
            }
        }
Esempio n. 5
0
        public static void PushDictionary(this IntPtr L, Dictionary <int, Tuple <string, string, string, int> > dict)
        {
            Lua.lua_newtable(L);
            foreach (var pair in dict)
            {
                Push(L, pair.Key);

                Lua.lua_newtable(L);

                Push(L, pair.Value.Item1);
                Lua.lua_rawseti(L, -2, 1);

                Push(L, pair.Value.Item2);
                Lua.lua_rawseti(L, -2, 2);

                Push(L, pair.Value.Item3);
                Lua.lua_rawseti(L, -2, 3);

                Push(L, pair.Value.Item4);
                Lua.lua_rawseti(L, -2, 4);

                Lua.lua_settable(L, -3);
            }
        }