Exemple #1
0
    static int Destroy(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1)
        {
            Object arg0 = (Object)L.ToUserData(1);
            MetaMethods.__gc(L);
            Object.Destroy(arg0);
            return(0);
        }
        else if (count == 2)
        {
            Object arg0 = (Object)L.ToUserData(1);
            float  arg1 = (float)L.ChkNumber(2);
            Object.Destroy(arg0, arg1);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: Object.Destroy");
        }

        return(0);
    }
Exemple #2
0
    static int DestroyImmediate(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1)
        {
            Object arg0 = (Object)L.ToUserData(1);
            MetaMethods.__gc(L);
            Object.DestroyImmediate(arg0);
            return(0);
        }
        else if (count == 2)
        {
            Object arg0 = (Object)L.ToUserData(1);
            bool   arg1 = L.ChkBoolean(2);
            Object.DestroyImmediate(arg0, arg1);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: Object.DestroyImmediate");
        }

        return(0);
    }
Exemple #3
0
	static int GetClassType(IntPtr L)
	{
		int count = L.GetTop();
		if (count == 0) {
			L.PushLightUserData(typeof(SystemInfo));
			return 1;
		} else {
			return MetaMethods.GetType(L);
		}
	}
	static int GetClassType(IntPtr L)
	{
		int count = L.GetTop();
		if (count == 0) {
			L.PushLightUserData(typeof(ZFrame.UGUI.UICloseButton));
			return 1;
		} else {
			return MetaMethods.GetType(L);
		}
	}
Exemple #5
0
    static int GetClassType(IntPtr L)
    {
        int count = L.GetTop();

        if (count == 0)
        {
            L.PushLightUserData(typeof(RectTransform));
            return(1);
        }
        else
        {
            return(MetaMethods.GetType(L));
        }
    }
Exemple #6
0
    static int GetClassType(IntPtr L)
    {
        int count = L.GetTop();

        if (count == 0)
        {
            L.PushLightUserData(typeof(ZFrame.NetEngine.TcpClientHandler));
            return(1);
        }
        else
        {
            return(MetaMethods.GetType(L));
        }
    }
    static int GetClassType(IntPtr L)
    {
        int count = L.GetTop();

        if (count == 0)
        {
            L.PushLightUserData(typeof(MonoBehaviour));
            return(1);
        }
        else
        {
            return(MetaMethods.GetType(L));
        }
    }
    static int GetClassType(IntPtr L)
    {
        int count = L.GetTop();

        if (count == 0)
        {
            L.PushLightUserData(typeof(WaitForSeconds));
            return(1);
        }
        else
        {
            return(MetaMethods.GetType(L));
        }
    }
    static int GetClassType(ILuaState L)
    {
        int count = L.GetTop();

        if (count == 0)
        {
            L.PushLightUserData(typeof(Color));
            return(1);
        }
        else
        {
            return(MetaMethods.GetType(L));
        }
    }
Exemple #10
0
    static int GetClassType(IntPtr L)
    {
        int count = L.GetTop();

        if (count == 0)
        {
            L.PushLightUserData(typeof(ZFrame.UGUI.UISelectable));
            return(1);
        }
        else
        {
            return(MetaMethods.GetType(L));
        }
    }
    static int GetClassType(IntPtr L)
    {
        int count = L.GetTop();

        if (count == 0)
        {
            L.PushLightUserData(typeof(UnityEngine.UI.ScrollRect));
            return(1);
        }
        else
        {
            return(MetaMethods.GetType(L));
        }
    }
Exemple #12
0
    static int GetClassType(IntPtr L)
    {
        int count = L.GetTop();

        if (count == 0)
        {
            L.PushLightUserData(typeof(ZFrame.AudioManager));
            return(1);
        }
        else
        {
            return(MetaMethods.GetType(L));
        }
    }
    static int GetClassType(IntPtr L)
    {
        int count = L.GetTop();

        if (count == 0)
        {
            L.PushLightUserData(typeof(clientlib.net.NetMsg));
            return(1);
        }
        else
        {
            return(MetaMethods.GetType(L));
        }
    }
    static int GetClassType(IntPtr L)
    {
        int count = L.GetTop();

        if (count == 0)
        {
            L.PushLightUserData(typeof(UnityEngine.EventSystems.PointerEventData));
            return(1);
        }
        else
        {
            return(MetaMethods.GetType(L));
        }
    }
Exemple #15
0
    private static int Delete(ILuaState lua)
    {
        Object obj   = lua.ToUnityObject(1);
        float  delay = (float)lua.OptNumber(2, 0f);

        if (obj != null)
        {
            Object.Destroy(obj, delay);
            if (lua.Type(1) == LuaTypes.LUA_TUSERDATA)
            {
                MetaMethods.__gc(lua);
            }
        }
        return(0);
    }
Exemple #16
0
    public LuaEnv()
    {
        s_MultiEnv     = this;
        LuaStatic.Load = LoadFile;

        ls = new LuaState();

        // UserData元表设置方法 (不依赖debug库)
        L.PushCSharpFunction(SetUDataMetaTable);
        L.SetField(LuaIndexes.LUA_GLOBALSINDEX, "setudatametatable");

        LuaDLL.luaopen_cjson(L);
        L.SetField(LuaIndexes.LUA_GLOBALSINDEX, "cjson");

        MetaMethods.RegTableCall(L);
        PreBinding();
    }
    private static int __index_IList(ILuaState L)
    {
        LuaTypes luaType = L.Type(2);

        if (luaType == LuaTypes.LUA_TNUMBER)
        {
            IList obj = L.ChkUserDataSelf(1, META_TABLE) as IList;

            if (obj == null)
            {
                L.L_Error("trying to index an invalid IList reference");
                return(0);
            }

            int index = L.ToInteger(2);

            if (index >= obj.Count)
            {
                L.L_Error(string.Format("index out of bounds: {0}/{1}", index, obj.Count));
                return(0);
            }

            object val = obj[index];

            if (val == null)
            {
                L.L_Error(string.Format("index {0} is null", index));
                return(0);
            }

            L.PushAnyObject(val);
            return(1);
        }
        else if (luaType == LuaTypes.LUA_TSTRING)
        {
            return(MetaMethods.__index(L));
        }

        L.L_Error(string.Format("unknown key for IList, got {0}", luaType));
        return(0);
    }
Exemple #18
0
    private static int __index_Array(ILuaState L)
    {
        LuaTypes luaType = L.Type(2);

        if (luaType == LuaTypes.LUA_TNUMBER)
        {
            System.Array obj = L.ChkUserDataSelf(1, CLASS) as System.Array;

            if (obj == null)
            {
                L.L_Error("trying to index an invalid Array reference");
                return(0);
            }

            int index = L.ToInteger(2);

            if (index >= obj.Length)
            {
                L.L_Error(string.Format("array index out of bounds: {0}/{1}", index, obj.Length));
                return(0);
            }

            object val = obj.GetValue(index);

            if (val == null)
            {
                L.L_Error(string.Format("array index {0} is null", index));
                return(0);
            }

            L.PushAnyObject(val);
            return(1);
        }
        else if (luaType == LuaTypes.LUA_TSTRING)
        {
            return(MetaMethods.__index(L));
        }

        L.L_Error(string.Format("unknown key for Array, got {0}", luaType));
        return(0);
    }
 public static MethodInvocationExpression bar(StringLiteralExpression argument)
 {
     return(MetaMethods.GenerateIExpressionInvocationFor("bar", argument));
 }
 public static MethodInvocationExpression foo()
 {
     return(MetaMethods.GenerateIExpressionInvocationFor("foo", null));
 }
Exemple #21
0
 static int Destroy(IntPtr L)
 {
     MetaMethods.__gc(L);
     return(0);
 }