private static int GetMethod(IntPtr L) { try { int num = LuaDLL.lua_gettop(L); Type type = (Type)ToLua.CheckObject(L, 1, typeof(Type)); string name = ToLua.CheckString(L, 2); Type[] array = null; if (num > 2) { array = new Type[num - 2]; for (int i = 3; i <= num; i++) { Type type2 = (Type)ToLua.CheckObject(L, i, typeof(Type)); if (type2 == null) { LuaDLL.luaL_typerror(L, i, "Type", null); } array[i - 3] = type2; } } MethodInfo method; if (array == null) { method = type.GetMethod(name); } else { method = type.GetMethod(name, array); } LuaReflection.PushLuaMethod(L, method, type, array); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, null)); } return(1); }
public string CheckString(int stackPos) { return(ToLua.CheckString(L, stackPos)); }