generated from marked/CSSharpTemplate
Initial commit
This commit is contained in:
commit
a44fe0dbe0
20 changed files with 1237 additions and 0 deletions
24
lune/pkg/result.luau
Normal file
24
lune/pkg/result.luau
Normal 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>)
|
Loading…
Add table
Add a link
Reference in a new issue