Ejemplo n.º 1
0
        public void AddChild(string name, System.Object obj)
        {
            childNameList.Add(name);
            int       objectID  = ObjectCache.SaveObject(obj);
            ObjectRef objectRef = new ObjectRef(objectID);

            childObjectRefList.Add(objectRef);
        }
Ejemplo n.º 2
0
 static int StaticGetChildObjectByName(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         LuaPerfect.ObjectItem arg0 = (LuaPerfect.ObjectItem)ToLua.CheckObject <LuaPerfect.ObjectItem>(L, 1);
         string arg1            = ToLua.CheckString(L, 2);
         LuaPerfect.ObjectRef o = LuaPerfect.ObjectItem.StaticGetChildObjectByName(arg0, arg1);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Ejemplo n.º 3
0
 static int StaticGetChildObject(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         LuaPerfect.ObjectItem arg0 = (LuaPerfect.ObjectItem)ToLua.CheckObject <LuaPerfect.ObjectItem>(L, 1);
         int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
         LuaPerfect.ObjectRef o = LuaPerfect.ObjectItem.StaticGetChildObject(arg0, arg1);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Ejemplo n.º 4
0
    static int set_objectID(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            LuaPerfect.ObjectRef obj = (LuaPerfect.ObjectRef)o;
            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.objectID = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index objectID on a nil value"));
        }
    }
Ejemplo n.º 5
0
    static int get_objectID(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            LuaPerfect.ObjectRef obj = (LuaPerfect.ObjectRef)o;
            int ret = obj.objectID;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index objectID on a nil value"));
        }
    }
Ejemplo n.º 6
0
        public static ObjectItem FormatObject(System.Object obj, bool collectChildren)
        {
            System.Object obj1 = obj;
            if (obj.GetType() == typeof(ObjectRef))
            {
                ObjectRef objectRef = (ObjectRef)obj;
                obj1 = ObjectCache.GetObject(objectRef.objectID);
            }
            ObjectItem objectItem = null;

            try
            {
                objectItem = InnerFormatObject(obj1, collectChildren);
            }
            catch
            {
                objectItem = new ObjectItem();
            }
            return(objectItem);
        }
Ejemplo n.º 7
0
    static int _CreateLuaPerfect_ObjectRef(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                LuaPerfect.ObjectRef obj = new LuaPerfect.ObjectRef(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LuaPerfect.ObjectRef.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }