Skip to content

Commit

Permalink
Add iterator to shared table
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyMorganz committed Dec 14, 2024
1 parent b4bd1a1 commit 6472c54
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions scripts/dumpRobloxTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"


Expand Down Expand Up @@ -957,26 +958,26 @@ 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]:
return False
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

Expand All @@ -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
)


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"]:
Expand Down Expand Up @@ -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"]:
Expand Down

0 comments on commit 6472c54

Please sign in to comment.