GetClassType() public static method

public static GetClassType ( IntPtr L, int reference ) : Type
L System.IntPtr
reference int
return System.Type
Esempio n. 1
0
        static int GetClassType(IntPtr L)
        {
            int reference = LuaDLL.tolua_getmetatableref(L, -1);

            if (reference > 0)
            {
                Type t = LuaStatic.GetClassType(L, reference);
                Push(L, t);
            }
            else
            {
                LuaValueType ret = LuaDLL.tolua_getvaluetype(L, -1);

                switch (ret)
                {
                case LuaValueType.Vector3:
                    Push(L, typeof(Vector3));
                    break;

                case LuaValueType.Quaternion:
                    Push(L, typeof(Quaternion));
                    break;

                case LuaValueType.Vector4:
                    Push(L, typeof(Vector4));
                    break;

                case LuaValueType.Color:
                    Push(L, typeof(Color));
                    break;

                case LuaValueType.Ray:
                    Push(L, typeof(Ray));
                    break;

                case LuaValueType.Bounds:
                    Push(L, typeof(Bounds));
                    break;

                case LuaValueType.Vector2:
                    Push(L, typeof(Vector2));
                    break;

                case LuaValueType.LayerMask:
                    Push(L, typeof(LayerMask));
                    break;

                case LuaValueType.RaycastHit:
                    Push(L, typeof(RaycastHit));
                    break;

                default:
                    Debugger.LogError("type not register to lua");
                    LuaDLL.lua_pushnil(L);
                    break;
                }
            }

            return(1);
        }
Esempio n. 2
0
        private static int GetClassType(IntPtr L)
        {
            int num = LuaDLL.tolua_getmetatableref(L, -1);

            if (num > 0)
            {
                Type classType = LuaStatic.GetClassType(L, num);
                ToLua.Push(L, classType);
            }
            else
            {
                switch (LuaDLL.tolua_getvaluetype(L, -1))
                {
                case LuaValueType.Vector3:
                    ToLua.Push(L, typeof(Vector3));
                    return(1);

                case LuaValueType.Quaternion:
                    ToLua.Push(L, typeof(Quaternion));
                    return(1);

                case LuaValueType.Vector2:
                    ToLua.Push(L, typeof(Vector2));
                    return(1);

                case LuaValueType.Color:
                    ToLua.Push(L, typeof(Color));
                    return(1);

                case LuaValueType.Vector4:
                    ToLua.Push(L, typeof(Vector4));
                    return(1);

                case LuaValueType.Ray:
                    ToLua.Push(L, typeof(Ray));
                    return(1);

                case LuaValueType.Bounds:
                    ToLua.Push(L, typeof(Bounds));
                    return(1);

                case LuaValueType.LayerMask:
                    ToLua.Push(L, typeof(LayerMask));
                    return(1);

                case LuaValueType.RaycastHit:
                    ToLua.Push(L, typeof(RaycastHit));
                    return(1);
                }
                Debugger.LogError("type not register to lua");
                LuaDLL.lua_pushnil(L);
            }
            return(1);
        }