Initial commit

This commit is contained in:
marked 2025-04-05 18:29:25 +02:00
commit a44fe0dbe0
20 changed files with 1237 additions and 0 deletions

24
lune/pkg/result.luau Normal file
View file

@ -0,0 +1,24 @@
--!strict
export type Identity<T> = {
ok: true,
val: T,
} | {
ok: false,
err: string,
}
local function construct<T>(ok: boolean, value: T & string): Identity<T>
if ok then
return {
ok = true,
val = value,
}
else
return {
ok = false,
err = value,
}
end
end
return (construct :: any) :: (<T>(ok: true, value: T) -> Identity<T>) & (<T>(ok: false, value: string) -> Identity<T>)