Better HN
topnewbestaskshowjobs
Log inSign up

CompeyDev

1 karma · joined May 22, 2025 (1y ago) · 2 submissions

Submissions

comment 1y ago · link · parent

Luau is gradually typed, so as long as you type it strictly (which is a little bit more than just defining the method with colon-notation, but there has been interest in making it simpler), it will catch this.

Unless you're using metatables, this would just be manually defining `self` with a type containing the fields you want it to represent.

For example:

```luau local Module = {} export type Module = { field: string }

function Module.Something(self: Module) print(self.field) end

return Module ```

EDIT: oops, new to this site; expected codeblocks to be a thing :p

comment 1y ago · link · parent

Hey! Yet another long-term contributor to Lune, and this is something I've experimented with for a while, but it wasn't possible due to our heavy reliance on Tokio for async I/O for a while. That has recently changed though, so I'm curious if that has changed much. I might try again and report back here.

However, I should mention that there is another Luau runtime called cart which has the sole goal of being heavily portable across environments -- and it supports running within WASM! You can even interact with JS APIs and mutate the DOM to write websites with it, if you wanted to.

cart: https://github.com/crossapprt/cart