mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 13:00:37 +00:00
61 lines
1.6 KiB
Lua
61 lines
1.6 KiB
Lua
-- Lune v0.1.1
|
|
|
|
declare console: {
|
|
resetColor: () -> (),
|
|
setColor: (color: "black" | "red" | "green" | "yellow" | "blue" | "purple" | "cyan" | "white") -> (),
|
|
resetStyle: () -> (),
|
|
setStyle: (style: "bold" | "dim") -> (),
|
|
format: (...any) -> (string),
|
|
log: (...any) -> (),
|
|
info: (...any) -> (),
|
|
warn: (...any) -> (),
|
|
error: (...any) -> (),
|
|
}
|
|
|
|
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,
|
|
}
|
|
|
|
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,
|
|
}
|
|
|
|
declare process: {
|
|
args: { string },
|
|
env: { [string]: string? },
|
|
exit: (code: number?) -> (),
|
|
spawn: (program: string, params: { string }?) -> {
|
|
ok: boolean,
|
|
code: number,
|
|
stdout: string,
|
|
stderr: string,
|
|
},
|
|
}
|
|
|
|
declare task: {
|
|
cancel: (thread: thread) -> (),
|
|
defer: <T...>(functionOrThread: thread | (T...) -> (...any), T...) -> thread,
|
|
delay: <T...>(duration: number?, functionOrThread: thread | (T...) -> (...any), T...) -> thread,
|
|
spawn: <T...>(functionOrThread: thread | (T...) -> (...any), T...) -> thread,
|
|
wait: (duration: number?) -> (number),
|
|
}
|