2023-01-21 02:18:11 +00:00
|
|
|
-- Lune v0.0.4
|
2023-01-19 19:57:39 +00:00
|
|
|
|
2023-01-20 03:10:34 +00:00
|
|
|
declare console: {
|
|
|
|
resetColor: () -> (),
|
|
|
|
setColor: (color: "black" | "red" | "green" | "yellow" | "blue" | "purple" | "cyan" | "white") -> (),
|
|
|
|
resetStyle: () -> (),
|
2023-01-21 06:37:31 +00:00
|
|
|
setStyle: (style: "bold" | "dim") -> (),
|
2023-01-20 03:10:34 +00:00
|
|
|
format: (...any) -> (string),
|
|
|
|
log: (...any) -> (),
|
|
|
|
info: (...any) -> (),
|
|
|
|
warn: (...any) -> (),
|
|
|
|
error: (...any) -> (),
|
|
|
|
}
|
|
|
|
|
2023-01-19 01:47:14 +00:00
|
|
|
declare fs: {
|
|
|
|
readFile: (path: string) -> string,
|
|
|
|
readDir: (path: string) -> { string },
|
|
|
|
writeFile: (path: string, contents: string) -> (),
|
|
|
|
writeDir: (path: string) -> (),
|
|
|
|
removeFile: (path: string) -> (),
|
|
|
|
removeDir: (path: string) -> (),
|
|
|
|
isFile: (path: string) -> boolean,
|
|
|
|
isDir: (path: string) -> boolean,
|
|
|
|
}
|
|
|
|
|
2023-01-19 22:56:12 +00:00
|
|
|
declare net: {
|
|
|
|
request: (config: string | {
|
|
|
|
url: string,
|
|
|
|
method: ("GET" | "POST" | "PUT" | "DELETE" | "HEAD" | "OPTIONS" | "PATCH")?,
|
|
|
|
headers: { [string]: string }?,
|
|
|
|
body: string?,
|
|
|
|
}) -> {
|
|
|
|
ok: boolean,
|
|
|
|
statusCode: number,
|
|
|
|
statusMessage: string,
|
|
|
|
headers: { [string]: string },
|
|
|
|
body: string,
|
|
|
|
},
|
|
|
|
jsonEncode: (value: any, pretty: boolean?) -> string,
|
|
|
|
jsonDecode: (encoded: string) -> any,
|
2023-01-19 01:47:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
declare process: {
|
2023-01-20 20:21:20 +00:00
|
|
|
args: { string },
|
|
|
|
env: { [string]: string? },
|
2023-01-19 01:47:14 +00:00
|
|
|
exit: (code: number?) -> (),
|
|
|
|
spawn: (program: string, params: { string }?) -> {
|
|
|
|
ok: boolean,
|
|
|
|
code: number,
|
|
|
|
stdout: string,
|
|
|
|
stderr: string,
|
|
|
|
},
|
|
|
|
}
|
2023-01-21 18:33:33 +00:00
|
|
|
|
|
|
|
declare task: {
|
2023-01-21 22:23:39 +00:00
|
|
|
cancel: (t: thread) -> (),
|
2023-01-21 20:07:18 +00:00
|
|
|
defer: <A..., R...>(f: thread | (A...) -> (R...), A...) -> (R...),
|
|
|
|
delay: <A..., R...>(duration: number?, f: thread | (A...) -> (R...), A...) -> (R...),
|
|
|
|
spawn: <A..., R...>(f: thread | (A...) -> (R...), A...) -> (R...),
|
2023-01-21 18:33:33 +00:00
|
|
|
wait: (duration: number?) -> (number),
|
|
|
|
}
|