Ejemplo n.º 1
0
        static int EndSample(IntPtr L)
        {
            try
            {
                int count = LuaDLL.lua_gettop(L);

                if (count == 0)
                {
                    MikuLuaProfiler.LuaProfiler.EndSample();
                    return(0);
                }
                else if (count == 1)
                {
                    System.IntPtr arg0 = ToLua.CheckIntPtr(L, 1);
                    MikuLuaProfiler.LuaProfiler.EndSample(arg0);
                    return(0);
                }
                else
                {
                    return(LuaDLL.luaL_throw(L, "invalid arguments to method: MikuLuaProfiler.LuaProfiler.EndSample"));
                }
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }
        }
Ejemplo n.º 2
0
        static int BeginSample(IntPtr L)
        {
            try
            {
                int count = LuaDLL.lua_gettop(L);

                if (count == 1 && TypeChecker.CheckTypes <System.IntPtr>(L, 1))
                {
                    System.IntPtr arg0 = ToLua.CheckIntPtr(L, 1);
                    MikuLuaProfiler.LuaProfiler.BeginSample(arg0);
                    return(0);
                }
                else if (count == 1 && TypeChecker.CheckTypes <string>(L, 1))
                {
                    string arg0 = ToLua.ToString(L, 1);
                    MikuLuaProfiler.LuaProfiler.BeginSample(arg0);
                    return(0);
                }
                else if (count == 2)
                {
                    System.IntPtr arg0 = ToLua.CheckIntPtr(L, 1);
                    string        arg1 = ToLua.CheckString(L, 2);
                    MikuLuaProfiler.LuaProfiler.BeginSample(arg0, arg1);
                    return(0);
                }
                else
                {
                    return(LuaDLL.luaL_throw(L, "invalid arguments to method: MikuLuaProfiler.LuaProfiler.BeginSample"));
                }
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }
        }
Ejemplo n.º 3
0
        static int GetProperty(IntPtr L)
        {
            try
            {
                int count = LuaDLL.lua_gettop(L);

                if (count == 2 && TypeChecker.CheckTypes <Type, string>(L, 1))
                {
                    Type         obj  = (Type)ToLua.ToObject(L, 1);
                    string       arg0 = ToLua.ToString(L, 2);
                    PropertyInfo o    = obj.GetProperty(arg0);
                    PushLuaProperty(L, o, obj);
                    return(1);
                }
                else if (count == 3 && TypeChecker.CheckTypes <Type, string, Type[]>(L, 1))
                {
                    Type         obj  = (Type)ToLua.ToObject(L, 1);
                    string       arg0 = ToLua.ToString(L, 2);
                    Type[]       arg1 = ToLua.ToObjectArray <Type>(L, 3);
                    PropertyInfo o    = obj.GetProperty(arg0, arg1);
                    PushLuaProperty(L, o, obj);
                    return(1);
                }
                else if (count == 3 && TypeChecker.CheckTypes <Type, string, Type>(L, 1))
                {
                    Type         obj  = (Type)ToLua.ToObject(L, 1);
                    string       arg0 = ToLua.ToString(L, 2);
                    Type         arg1 = (Type)ToLua.ToObject(L, 3);
                    PropertyInfo o    = obj.GetProperty(arg0, arg1);
                    PushLuaProperty(L, o, obj);
                    return(1);
                }
                else if (count == 3 && TypeChecker.CheckTypes <Type, string, uint>(L, 1))
                {
                    Type         obj  = (Type)ToLua.ToObject(L, 1);
                    string       arg0 = ToLua.ToString(L, 2);
                    BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);
                    PropertyInfo o    = obj.GetProperty(arg0, arg1);
                    PushLuaProperty(L, o, obj);
                    return(1);
                }
                else if (count == 4 && TypeChecker.CheckTypes <Type, string, Type, Type[]>(L, 1))
                {
                    Type         obj  = (Type)ToLua.ToObject(L, 1);
                    string       arg0 = ToLua.ToString(L, 2);
                    Type         arg1 = (Type)ToLua.ToObject(L, 3);
                    Type[]       arg2 = ToLua.ToObjectArray <Type>(L, 4);
                    PropertyInfo o    = obj.GetProperty(arg0, arg1, arg2);
                    PushLuaProperty(L, o, obj);
                    return(1);
                }
                else if (count == 5 && TypeChecker.CheckTypes <Type, string, Type, Type[], ParameterModifier[]> (L, 1))
                {
                    Type   obj  = (Type)ToLua.ToObject(L, 1);
                    string arg0 = ToLua.ToString(L, 2);
                    Type   arg1 = (Type)ToLua.ToObject(L, 3);
                    Type[] arg2 = ToLua.ToObjectArray <Type>(L, 4);
                    ParameterModifier[] arg3 = ToLua.ToStructArray <ParameterModifier>(L, 5);
                    PropertyInfo        o    = obj.GetProperty(arg0, arg1, arg2, arg3);
                    PushLuaProperty(L, o, obj);
                    return(1);
                }
                else if (count == 7 && TypeChecker.CheckTypes <Type, string, uint, Binder, Type, Type[], ParameterModifier[]> (L, 1))
                {
                    Type                obj  = (Type)ToLua.ToObject(L, 1);
                    string              arg0 = ToLua.ToString(L, 2);
                    BindingFlags        arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);
                    Binder              arg2 = (Binder)ToLua.ToObject(L, 4);
                    Type                arg3 = (Type)ToLua.ToObject(L, 5);
                    Type[]              arg4 = ToLua.ToObjectArray <Type>(L, 6);
                    ParameterModifier[] arg5 = ToLua.ToStructArray <ParameterModifier>(L, 7);
                    PropertyInfo        o    = obj.GetProperty(arg0, arg1, arg2, arg3, arg4, arg5);
                    PushLuaProperty(L, o, obj);
                    return(1);
                }
                else
                {
                    return(LuaDLL.luaL_throw(L, "invalid arguments to method: tolua.getproperty"));
                }
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }
        }
Ejemplo n.º 4
0
        static int GetTypeMethod(IntPtr L)
        {
            try
            {
                int count = LuaDLL.lua_gettop(L);

                if (count == 2 && TypeChecker.CheckTypes <Type, string>(L, 1))
                {
                    Type       obj  = (Type)ToLua.ToObject(L, 1);
                    string     arg0 = ToLua.ToString(L, 2);
                    MethodInfo o    = obj.GetMethod(arg0);
                    PushLuaMethod(L, o, obj, null);
                    return(1);
                }
                else if (count == 3 && TypeChecker.CheckTypes <Type, string, Type[]>(L, 1))
                {
                    Type       obj  = (Type)ToLua.ToObject(L, 1);
                    string     arg0 = ToLua.ToString(L, 2);
                    Type[]     arg1 = ToLua.ToObjectArray <Type>(L, 3);
                    MethodInfo o    = obj.GetMethod(arg0, arg1);
                    PushLuaMethod(L, o, obj, arg1);
                    return(1);
                }
                else if (count == 3 && TypeChecker.CheckTypes <Type, string, uint>(L, 1))
                {
                    Type         obj  = (Type)ToLua.ToObject(L, 1);
                    string       arg0 = ToLua.ToString(L, 2);
                    BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);
                    MethodInfo   o    = obj.GetMethod(arg0, arg1);
                    PushLuaMethod(L, o, obj, null);
                    return(1);
                }
                else if (count == 4 && TypeChecker.CheckTypes <Type, string, Type[], ParameterModifier[]>(L, 1))
                {
                    Type   obj  = (Type)ToLua.ToObject(L, 1);
                    string arg0 = ToLua.ToString(L, 2);
                    Type[] arg1 = ToLua.ToObjectArray <System.Type>(L, 3);
                    ParameterModifier[] arg2 = ToLua.ToStructArray <ParameterModifier>(L, 4);
                    MethodInfo          o    = obj.GetMethod(arg0, arg1, arg2);
                    PushLuaMethod(L, o, obj, arg1);
                    return(1);
                }
                else if (count == 6 && TypeChecker.CheckTypes <Type, string, uint, Binder, Type[], ParameterModifier[]> (L, 1))
                {
                    System.Type         obj  = (System.Type)ToLua.ToObject(L, 1);
                    string              arg0 = ToLua.ToString(L, 2);
                    BindingFlags        arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);
                    Binder              arg2 = (Binder)ToLua.ToObject(L, 4);
                    Type[]              arg3 = ToLua.ToObjectArray <Type>(L, 5);
                    ParameterModifier[] arg4 = ToLua.ToStructArray <ParameterModifier>(L, 6);
                    MethodInfo          o    = obj.GetMethod(arg0, arg1, arg2, arg3, arg4);
                    PushLuaMethod(L, o, obj, arg3);
                    return(1);
                }
                else if (count == 7 && TypeChecker.CheckTypes <Type, string, uint, Binder, CallingConventions, Type[], ParameterModifier[]> (L, 1))
                {
                    Type                obj  = (Type)ToLua.ToObject(L, 1);
                    string              arg0 = ToLua.ToString(L, 2);
                    BindingFlags        arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);
                    Binder              arg2 = (Binder)ToLua.ToObject(L, 4);
                    CallingConventions  arg3 = (CallingConventions)ToLua.ToObject(L, 5);
                    Type[]              arg4 = ToLua.ToObjectArray <Type>(L, 6);
                    ParameterModifier[] arg5 = ToLua.ToStructArray <ParameterModifier>(L, 7);
                    MethodInfo          o    = obj.GetMethod(arg0, arg1, arg2, arg3, arg4, arg5);
                    PushLuaMethod(L, o, obj, arg4);
                    return(1);
                }
                else
                {
                    return(LuaDLL.luaL_throw(L, "invalid arguments to method: tolua.gettypemethod"));
                }
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }
        }
Ejemplo n.º 5
0
        private static int GetProperty(IntPtr L)
        {
            int result;

            try
            {
                int num = LuaDLL.lua_gettop(L);
                if (num == 2 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string)))
                {
                    Type         type     = (Type)ToLua.ToObject(L, 1);
                    string       name     = ToLua.ToString(L, 2);
                    PropertyInfo property = type.GetProperty(name);
                    LuaReflection.PushLuaProperty(L, property, type);
                    result = 1;
                }
                else if (num == 3 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(Type[])))
                {
                    Type         type2     = (Type)ToLua.ToObject(L, 1);
                    string       name2     = ToLua.ToString(L, 2);
                    Type[]       types     = ToLua.CheckObjectArray <Type>(L, 3);
                    PropertyInfo property2 = type2.GetProperty(name2, types);
                    LuaReflection.PushLuaProperty(L, property2, type2);
                    result = 1;
                }
                else if (num == 3 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(Type)))
                {
                    Type         type3      = (Type)ToLua.ToObject(L, 1);
                    string       name3      = ToLua.ToString(L, 2);
                    Type         returnType = (Type)ToLua.ToObject(L, 3);
                    PropertyInfo property3  = type3.GetProperty(name3, returnType);
                    LuaReflection.PushLuaProperty(L, property3, type3);
                    result = 1;
                }
                else if (num == 3 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(uint)))
                {
                    Type         type4       = (Type)ToLua.ToObject(L, 1);
                    string       name4       = ToLua.ToString(L, 2);
                    BindingFlags bindingAttr = (BindingFlags)LuaDLL.lua_tonumber(L, 3);
                    PropertyInfo property4   = type4.GetProperty(name4, bindingAttr);
                    LuaReflection.PushLuaProperty(L, property4, type4);
                    result = 1;
                }
                else if (num == 4 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(Type), typeof(Type[])))
                {
                    Type         type5       = (Type)ToLua.ToObject(L, 1);
                    string       name5       = ToLua.ToString(L, 2);
                    Type         returnType2 = (Type)ToLua.ToObject(L, 3);
                    Type[]       types2      = ToLua.CheckObjectArray <Type>(L, 4);
                    PropertyInfo property5   = type5.GetProperty(name5, returnType2, types2);
                    LuaReflection.PushLuaProperty(L, property5, type5);
                    result = 1;
                }
                else if (num == 5 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(Type), typeof(Type[]), typeof(ParameterModifier[])))
                {
                    Type   type6                  = (Type)ToLua.ToObject(L, 1);
                    string name6                  = ToLua.ToString(L, 2);
                    Type   returnType3            = (Type)ToLua.ToObject(L, 3);
                    Type[] types3                 = ToLua.CheckObjectArray <Type>(L, 4);
                    ParameterModifier[] modifiers = ToLua.CheckObjectArray <ParameterModifier>(L, 5);
                    PropertyInfo        property6 = type6.GetProperty(name6, returnType3, types3, modifiers);
                    LuaReflection.PushLuaProperty(L, property6, type6);
                    result = 1;
                }
                else if (num == 7 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(uint), typeof(Binder), typeof(Type), typeof(Type[]), typeof(ParameterModifier[])))
                {
                    Type                type7        = (Type)ToLua.ToObject(L, 1);
                    string              name7        = ToLua.ToString(L, 2);
                    BindingFlags        bindingAttr2 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);
                    Binder              binder       = (Binder)ToLua.ToObject(L, 4);
                    Type                returnType4  = (Type)ToLua.ToObject(L, 5);
                    Type[]              types4       = ToLua.CheckObjectArray <Type>(L, 6);
                    ParameterModifier[] modifiers2   = ToLua.CheckObjectArray <ParameterModifier>(L, 7);
                    PropertyInfo        property7    = type7.GetProperty(name7, bindingAttr2, binder, returnType4, types4, modifiers2);
                    LuaReflection.PushLuaProperty(L, property7, type7);
                    result = 1;
                }
                else
                {
                    result = LuaDLL.luaL_throw(L, "invalid arguments to method: tolua.getproperty");
                }
            }
            catch (Exception e)
            {
                result = LuaDLL.toluaL_exception(L, e, null);
            }
            return(result);
        }
Ejemplo n.º 6
0
        private static int GetTypeMethod(IntPtr L)
        {
            int result;

            try
            {
                int num = LuaDLL.lua_gettop(L);
                if (num == 2 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string)))
                {
                    Type       type   = (Type)ToLua.ToObject(L, 1);
                    string     name   = ToLua.ToString(L, 2);
                    MethodInfo method = type.GetMethod(name);
                    LuaReflection.PushLuaMethod(L, method, type, null);
                    result = 1;
                }
                else if (num == 3 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(Type[])))
                {
                    Type       type2   = (Type)ToLua.ToObject(L, 1);
                    string     name2   = ToLua.ToString(L, 2);
                    Type[]     types   = ToLua.CheckObjectArray <Type>(L, 3);
                    MethodInfo method2 = type2.GetMethod(name2, types);
                    LuaReflection.PushLuaMethod(L, method2, type2, types);
                    result = 1;
                }
                else if (num == 3 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(uint)))
                {
                    Type         type3       = (Type)ToLua.ToObject(L, 1);
                    string       name3       = ToLua.ToString(L, 2);
                    BindingFlags bindingAttr = (BindingFlags)LuaDLL.lua_tonumber(L, 3);
                    MethodInfo   method3     = type3.GetMethod(name3, bindingAttr);
                    LuaReflection.PushLuaMethod(L, method3, type3, null);
                    result = 1;
                }
                else if (num == 4 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(Type[]), typeof(ParameterModifier[])))
                {
                    Type   type4  = (Type)ToLua.ToObject(L, 1);
                    string name4  = ToLua.ToString(L, 2);
                    Type[] types2 = ToLua.CheckObjectArray <Type>(L, 3);
                    ParameterModifier[] modifiers = ToLua.CheckObjectArray <ParameterModifier>(L, 4);
                    MethodInfo          method4   = type4.GetMethod(name4, types2, modifiers);
                    LuaReflection.PushLuaMethod(L, method4, type4, types2);
                    result = 1;
                }
                else if (num == 6 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(uint), typeof(Binder), typeof(Type[]), typeof(ParameterModifier[])))
                {
                    Type                type5        = (Type)ToLua.ToObject(L, 1);
                    string              name5        = ToLua.ToString(L, 2);
                    BindingFlags        bindingAttr2 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);
                    Binder              binder       = (Binder)ToLua.ToObject(L, 4);
                    Type[]              types3       = ToLua.CheckObjectArray <Type>(L, 5);
                    ParameterModifier[] modifiers2   = ToLua.CheckObjectArray <ParameterModifier>(L, 6);
                    MethodInfo          method5      = type5.GetMethod(name5, bindingAttr2, binder, types3, modifiers2);
                    LuaReflection.PushLuaMethod(L, method5, type5, types3);
                    result = 1;
                }
                else if (num == 7 && TypeChecker.CheckTypes(L, 1, typeof(Type), typeof(string), typeof(uint), typeof(Binder), typeof(CallingConventions), typeof(Type[]), typeof(ParameterModifier[])))
                {
                    Type                type6          = (Type)ToLua.ToObject(L, 1);
                    string              name6          = ToLua.ToString(L, 2);
                    BindingFlags        bindingAttr3   = (BindingFlags)LuaDLL.lua_tonumber(L, 3);
                    Binder              binder2        = (Binder)ToLua.ToObject(L, 4);
                    CallingConventions  callConvention = (CallingConventions)((int)ToLua.ToObject(L, 5));
                    Type[]              types4         = ToLua.CheckObjectArray <Type>(L, 6);
                    ParameterModifier[] modifiers3     = ToLua.CheckObjectArray <ParameterModifier>(L, 7);
                    MethodInfo          method6        = type6.GetMethod(name6, bindingAttr3, binder2, callConvention, types4, modifiers3);
                    LuaReflection.PushLuaMethod(L, method6, type6, types4);
                    result = 1;
                }
                else
                {
                    result = LuaDLL.luaL_throw(L, "invalid arguments to method: tolua.gettypemethod");
                }
            }
            catch (Exception e)
            {
                result = LuaDLL.toluaL_exception(L, e, null);
            }
            return(result);
        }