LuaInterface.ObjectTranslator.getMethodSignature C# (CSharp) Method

getMethodSignature() private method

private getMethodSignature ( IntPtr luaState ) : int
luaState System.IntPtr
return int
        private int getMethodSignature(IntPtr luaState)
        {
            IReflect klass; object target;
            int udata=LuaDLL.luanet_checkudata(luaState,1,"luaNet_class");
            if(udata!=-1)
            {
                klass=(IReflect)objects[udata];
                target=null;
            }
            else
            {
                target=getRawNetObject(luaState,1);
                if(target==null)
                {
                    throwError(luaState,"get_method_bysig: first arg is not type or object reference");
                    LuaDLL.lua_pushnil(luaState);
                    return 1;
                }
                klass=target.GetType();
            }
            string methodName=LuaDLL.lua_tostring(luaState,2);
            Type[] signature=new Type[LuaDLL.lua_gettop(luaState)-2];
            for(int i=0;i<signature.Length;i++)
                signature[i]=FindType(LuaDLL.lua_tostring(luaState,i+3));
            try
            {
                //CP: Added ignore case
                MethodInfo method=klass.GetMethod(methodName,BindingFlags.Public | BindingFlags.Static |
                    BindingFlags.Instance | BindingFlags.FlattenHierarchy | BindingFlags.IgnoreCase, null, signature, null);
                pushFunction(luaState,new LuaCSFunction((new LuaMethodWrapper(this,target,klass,method)).call));
            }
            catch(Exception e)
            {
                throwError(luaState,e);
                LuaDLL.lua_pushnil(luaState);
            }
            return 1;
        }