From 8b62a857e7c17dc29082d0852365bb6d511113e7 Mon Sep 17 00:00:00 2001 From: JohnnyMorganz Date: Sat, 14 Dec 2024 16:00:24 +0000 Subject: [PATCH] Add iterator to shared table (#867) --- scripts/dumpRobloxTypes.py | 49 +++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/scripts/dumpRobloxTypes.py b/scripts/dumpRobloxTypes.py index 3208f99a..f26b3925 100644 --- a/scripts/dumpRobloxTypes.py +++ b/scripts/dumpRobloxTypes.py @@ -624,6 +624,7 @@ POST_DATATYPES_BASE = """ declare class SharedTable [string | number]: any + function __iter(self): (any, number) -> (number, any) end export type OpenCloudModel = any @@ -876,7 +877,7 @@ chosenSecurityLevel = sys.argv[1] if len(sys.argv) > 1 else DEFAULT_SECURITY_LEVEL assert ( - chosenSecurityLevel in SECURITY_LEVELS + chosenSecurityLevel in SECURITY_LEVELS ), f"Unknown security level: {chosenSecurityLevel}" @@ -957,12 +958,12 @@ def resolveReturnType(member: Union[ApiFunction, ApiCallback]) -> str: def filterMember(klassName: str, member: ApiMember): if not INCLUDE_DEPRECATED_METHODS and ( - ( - "Tags" in member - and member["Tags"] is not None - and "Deprecated" in member["Tags"] - ) - or ("Deprecated" in member and member["Deprecated"]) + ( + "Tags" in member + and member["Tags"] is not None + and "Deprecated" in member["Tags"] + ) + or ("Deprecated" in member and member["Deprecated"]) ): return False if klassName in IGNORED_MEMBERS and member["Name"] in IGNORED_MEMBERS[klassName]: @@ -970,13 +971,13 @@ def filterMember(klassName: str, member: ApiMember): if "Security" in member: if isinstance(member["Security"], str): if SECURITY_LEVELS.index(member["Security"]) > SECURITY_LEVELS.index( - chosenSecurityLevel + chosenSecurityLevel ): return False else: if min( - SECURITY_LEVELS.index(member["Security"]["Read"]), - SECURITY_LEVELS.index(member["Security"]["Write"]), + SECURITY_LEVELS.index(member["Security"]["Read"]), + SECURITY_LEVELS.index(member["Security"]["Write"]), ) > SECURITY_LEVELS.index(chosenSecurityLevel): return False @@ -985,11 +986,11 @@ def filterMember(klassName: str, member: ApiMember): def shouldExcludeAsDeprecated(klass: ApiClass): return ( - not INCLUDE_DEPRECATED_METHODS - and "Tags" in klass - and klass["Tags"] is not None - and "Deprecated" in klass["Tags"] - and not klass["Name"] in OVERRIDE_DEPRECATED_REMOVAL + not INCLUDE_DEPRECATED_METHODS + and "Tags" in klass + and klass["Tags"] is not None + and "Deprecated" in klass["Tags"] + and not klass["Name"] in OVERRIDE_DEPRECATED_REMOVAL ) @@ -1101,10 +1102,10 @@ def printDataTypeConstructors(types: DataTypesDump): for member in members: if member["MemberType"] == "Function": if ( - name == "BrickColor" - and member["Name"] == "new" - and len(member["Parameters"]) == 1 - and member["Parameters"][0]["Type"]["Name"] == "string" + name == "BrickColor" + and member["Name"] == "new" + and len(member["Parameters"]) == 1 + and member["Parameters"][0]["Type"]["Name"] == "string" ): isBrickColorNew = True continue @@ -1175,8 +1176,8 @@ def applyCorrections(dump: ApiDump, corrections: CorrectionsDump): ]["Generic"] if ( - "Parameters" in member - and member["Parameters"] is not None + "Parameters" in member + and member["Parameters"] is not None ): for param in member["Parameters"]: for otherParam in otherMember["Parameters"]: @@ -1206,9 +1207,9 @@ def loadClassesIntoStructures(dump: ApiDump): isCreatable = True if "Tags" in klass and klass["Tags"] is not None: if ( - "Deprecated" in klass - and not INCLUDE_DEPRECATED_METHODS - and not klass["Name"] in OVERRIDE_DEPRECATED_REMOVAL + "Deprecated" in klass + and not INCLUDE_DEPRECATED_METHODS + and not klass["Name"] in OVERRIDE_DEPRECATED_REMOVAL ): continue if "Service" in klass["Tags"]: