ToBytes() 공개 메소드

public ToBytes ( byte dst ) : void
dst byte
리턴 void
예제 #1
0
    // use lunaStack::push if possible.
    public static void push(Lua.lua_State L, LWF.Point obj, bool gc, Lua.CharPtr metatable = null)
    {
        int objectId = -1;

        if (!objectIdentifiers[L].TryGetValue(obj, out objectId))
        {
            objectId = idOffset++;
            objectIdentifiers[L].Add(obj, objectId);
            objects[L].Add(objectId, obj);
        }

        if (metatable == null)
        {
            metatable = LunaTraits_LWF_Point.className;
        }
        Lua.lua_pushstring(L, "__luna");
        Lua.lua_gettable(L, Lua.LUA_GLOBALSINDEX);
        int __luna = Lua.lua_gettop(L);

        Luna.userdataType ud = new Luna.userdataType(
            objectId: objectId,  // store object in userdata
            gc: gc,              // collect garbage
            has_env: false,      // does this userdata has a table attached to it?
            typeId: LunaTraits_LWF_Point.uniqueID
            );

        ud.ToBytes((byte[])Lua.lua_newuserdata(L, Luna.userdataType.Size));

        Lua.lua_pushstring(L, metatable);
        Lua.lua_gettable(L, __luna);
        Lua.lua_setmetatable(L, -2);
        //Luna.printStack(L);
        Lua.lua_insert(L, -2);          // swap __luna and userdata
        Lua.lua_pop(L, 1);
    }
예제 #2
0
	// use lunaStack::push if possible.
	public static void push(Lua.lua_State L, LWF.Movie obj, bool gc, Lua.CharPtr metatable=null)
	{
		if (obj == null) {
			Lua.lua_pushnil(L);
			return;
		}

		int objectId = -1;
		if (!objectIdentifiers[L].TryGetValue(obj, out objectId))
		{
			objectId = idOffset ++;
			objectIdentifiers[L].Add(obj, objectId);
			objects[L].Add(objectId, obj);
		}

		if (metatable == null)
				metatable = LunaTraits_LWF_Movie.className;
		Lua.lua_pushstring(L,"__luna");
		Lua.lua_gettable(L, Lua.LUA_GLOBALSINDEX);
		int __luna= Lua.lua_gettop(L);

		Luna.userdataType ud = new Luna.userdataType(
			objectId:objectId,  // store object in userdata
			gc:gc,   // collect garbage
			has_env:false, // does this userdata has a table attached to it?
			typeId:LunaTraits_LWF_Movie.uniqueID
		);

		ud.ToBytes((byte[])Lua.lua_newuserdata(L, Luna.userdataType.Size));

		Lua.lua_pushstring(L, metatable);
		Lua.lua_gettable(L, __luna);
		Lua.lua_setmetatable(L, -2);
		//Luna.printStack(L);
		Lua.lua_insert(L, -2);  // swap __luna and userdata
		Lua.lua_pop(L,1);
	}