bool matchType(IntPtr l, int p, LuaTypes lt, Type t) { string tn = t.Name; switch (tn) { case "String": return(lt == LuaTypes.LUA_TSTRING); case "Int32": case "Uint32": case "Single": case "Double": return(lt == LuaTypes.LUA_TNUMBER); default: { switch (lt) { case LuaTypes.LUA_TFUNCTION: return(tn == "LuaFunction" || t.BaseType == typeof(MulticastDelegate)); case LuaTypes.LUA_TTABLE: return(tn == "LuaTable" || LuaObject.luaTypeCheck(l, p, tn)); default: return(lt == LuaTypes.LUA_TUSERDATA || tn == "Object"); } } } }
bool matchType(IntPtr l, int p, LuaTypes lt, Type t) { if (t.IsPrimitive && t != typeof(bool)) { return(lt == LuaTypes.LUA_TNUMBER); } if (t == typeof(bool)) { return(lt == LuaTypes.LUA_TBOOLEAN); } if (t == typeof(string)) { return(lt == LuaTypes.LUA_TSTRING); } switch (lt) { case LuaTypes.LUA_TFUNCTION: return(t == typeof(LuaFunction) || t.BaseType == typeof(MulticastDelegate)); case LuaTypes.LUA_TTABLE: return(t == typeof(LuaTable) || LuaObject.luaTypeCheck(l, p, t.Name)); default: return(lt == LuaTypes.LUA_TUSERDATA || t == typeof(object)); } }