Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions generated/secondlife.d.luau
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
----------------------------------

declare extern type quaternion with
x: number
y: number
z: number
s: number
read x: number
read y: number
read z: number
read s: number
function __add(self, other: quaternion): quaternion
function __sub(self, other: quaternion): quaternion
function __mul(self, other: quaternion): quaternion
Expand All @@ -20,15 +20,15 @@ declare extern type quaternion with
end

declare extern type uuid with
istruthy: boolean
bytes: string
read istruthy: boolean
read bytes: string
function __tostring(self): string
end

declare extern type vector with
x: number
y: number
z: number
read x: number
read y: number
read z: number
function __add(self, other: vector): vector
function __sub(self, other: vector): vector
function __unm(self): vector
Expand Down Expand Up @@ -155,9 +155,9 @@ export type HttpRequestParams = {
}

declare extern type DetectedEvent with
index: number
valid: boolean
canAdjustDamage: boolean
read index: number
read valid: boolean
read canAdjustDamage: boolean
function adjustDamage(self, new_damage: number): ()
function getDamage(self): {any}
function getGrab(self): vector
Expand Down
7 changes: 4 additions & 3 deletions lsl_definitions/slua.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def to_keywords_dict(self) -> dict:
**({"value": self.value} if self.value is not None else {}),
}

def to_luau_def(self) -> str:
return f"{self.name}: {self.type}"
def to_luau_def(self, extern: bool = False) -> str:
attributes = "read " if extern and self.modifiable == "read-only" else ""
return f"{attributes}{self.name}: {self.type}"


@dataclasses.dataclass
Expand Down Expand Up @@ -318,7 +319,7 @@ def _workaround_annotated_callable_bug(self) -> None:
def _write_extern_type_def(self, f: TextIO) -> None:
f.write(f"declare extern type {self.name} with\n")
for prop in self.properties.values():
f.write(f" {prop.to_luau_def()}\n")
f.write(f" {prop.to_luau_def(extern=True)}\n")
for func in self.functions.values():
func.write_luau_global_def(f, indent=1)
for func in self.methods.values():
Expand Down
Loading