push() public static method

public static push ( Lua L, LWF obj, bool gc, Lua metatable = null ) : void
L Lua
obj LWF
gc bool
metatable Lua
return void
Exemplo n.º 1
0
 public static int _bind_getLWF(Lua.lua_State L)
 {
     if (Lua.lua_gettop(L) != 1 || Luna.get_uniqueid(L, 1) !=
         LunaTraits_LWF_Button.uniqueID)
     {
         Luna.printStack(L);
         Lua.luaL_error(L, "luna typecheck failed: LWF.Button.lwf");
     }
     LWF.Button a = Luna_LWF_Button.check(L, 1);
     Luna_LWF_LWF.push(L, a.lwf, false);
     return(1);
 }
Exemplo n.º 2
0
        public int AttachLWFLua(Movie movie)
        {
            if (luaState == null)
            {
                return(0);
            }

            Lua.lua_State l    = (Lua.lua_State)luaState;
            int           args = Lua.lua_gettop(l);
            string        attachName;
            string        path;
            int           attachDepth   = -1;
            bool          reorder       = false;
            string        texturePrefix = null;

            /* 1: LWF_Movie instance */
            /* 2: path:string */
            /* 3: attachName:string */
            /* 4: attachDepth:number (option) */
            /* 5: reorder:boolean (option) */
            /* 6: texturePrefix:string (option) */
            path       = Lua.lua_tostring(l, 2).ToString();
            attachName = Lua.lua_tostring(l, 3).ToString();
            if (args >= 4)
            {
                attachDepth = (int)Lua.lua_tonumber(l, 4);
            }
            if (args >= 5)
            {
                reorder = Lua.lua_toboolean(l, 5) != 0;
            }
            if (args >= 6)
            {
                texturePrefix = Lua.lua_tostring(l, 6).ToString();
            }

            LWF child = movie.AttachLWF(
                path, attachName, attachDepth, reorder, texturePrefix);

            if (child != null)
            {
                Luna_LWF_LWF.push(l, child, false);
                /* -1: LWF_LWF child */
            }
            else
            {
                Lua.lua_pushnil(l);
                /* -1: nil */
            }
            return(1);
        }
Exemplo n.º 3
0
        public void DestroyMovieLua(Movie movie)
        {
            if (luaState == null)
            {
                return;
            }

            Lua.lua_State l = (Lua.lua_State)luaState;
            Lua.lua_getglobal(l, "LWF");
            /* -1: LWF */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, "Script");
            /* -2: LWF */
            /* -1: LWF.Script */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Script */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, name);
            /* -2: LWF.Script */
            /* -1: LWF.Script.<name> */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Script.<name> */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, "Destroy");
            /* -2: LWF.Script.<name> */
            /* -1: LWF.Script.<name>.Destroy */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Script.<name>.Destroy */
            if (Lua.lua_isfunction(l, -1))
            {
                Luna_LWF_LWF.push(l, this, false);
                /* -2: LWF.Script.<name>.Destroy */
                /* -1: LWF instance */
                if (Lua.lua_pcall(l, 1, 0, 0) != 0)
                {
                    Lua.lua_pop(l, 1);
                }
                /* 0 */
            }
            Lua.lua_getglobal(l, "LWF");
            /* -1: LWF */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, "Instances");
            /* -2: LWF */
            /* -1: LWF.Instances */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Instances */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, instanceIdString);
            /* -2: LWF.Instances */
            /* -1: LWF.Instances.<instanceId> */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Instances.<instanceId> */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, "Movies");
            /* -2: LWF.Instances.<instanceId> */
            /* -1: LWF.Instances.<instanceId>.Movies */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Instances.<instanceId>.Movies */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_pushnil(l);
            /* -2: LWF.Instances.<instanceId>.Movies */
            /* -1: nil */
            Lua.lua_setfield(l, -2, movie.iObjectId.ToString());
            /* LWF.Instances.<instanceId>.Movies.<iObjectId> = nil */
            /* -1: LWF.Instances.<instanceId>.Movies */
            Lua.lua_pop(l, 1);
            /* 0 */
            Luna_LWF_Movie.Destroy(l, movie);
            return;
        }