Implement framebuffer and mock endpoint

This commit is contained in:
2022-09-20 12:16:46 +02:00
parent 92496c8b8e
commit 1fde73778b
14 changed files with 872 additions and 0 deletions

51
lua/types/colors.d.tl Normal file
View File

@@ -0,0 +1,51 @@
global record colors
white: number
orange: number
magenta: number
lightBlue: number
yellow: number
lime: number
pink: number
gray: number
lightGray: number
cyan: number
purple: number
blue: number
brown: number
green: number
red: number
black: number
combine: function(...: number): number
subtract: function(colors: number, ...: number): number
test: function(colors: number, color: number): boolean
packRGB: function(r: number, g: number, b: number): number
unpackRGB: function(rgb: number): number, number, number
toBlit: function(color: number): string
end
global record colours
white: number
orange: number
magenta: number
lightBlue: number
yellow: number
lime: number
pink: number
grey: number
lightGrey: number
cyan: number
purple: number
blue: number
brown: number
green: number
red: number
black: number
combine: function(...: number): number
subtract: function(colors: number, ...: number): number
test: function(colors: number, color: number): boolean
packRGB: function(r: number, g: number, b: number): number
unpackRGB: function(rgb: number): number, number, number
toBlit: function(color: number): string
end

70
lua/types/http.d.tl Normal file
View File

@@ -0,0 +1,70 @@
global record http
record Response
getResponseCode: function(): integer, string
getResponseHeaders: function(): {string: string}
read: function(count: integer | nil): integer, string | nil
readAll: function(): string | nil
readLine: function(withTrailing: boolean | nil): string | nil
seek: function(
whence: string | nil,
offset: integer | nil
): integer | nil, nil | string
close: function()
end
record _RequestParams
url: string
body: string | nil
headers: {string: string} | nil
binary: boolean | nil
method: string | nil
redirect: boolean | nil
end
request: function(
url_or_params: string | _RequestParams,
body: string | nil,
headers: {string: string} | nil,
binary: boolean | nil
)
record _GetParams
url: string
headers: {string: string} | nil
binary: boolean | nil
method: string | nil
redirect: boolean | nil
end
get: function(
url_or_params: string | _GetParams,
headers: {string: string} | nil,
binary: boolean | nil
): Response | nil, nil | string, nil | Response
post: function(
url_or_params: string | _RequestParams,
body: string | nil,
headers: {string: string} | nil,
binary: boolean | nil
): Response | nil, nil | string, nil | Response
checkURLAsync: function(url: string): boolean, string | nil
checkURL: function(url: string): boolean, string | nil
record Websocket
receive: function(timeout: number | nil): string | nil, nil | boolean
send: function(message: any, binary: boolean | nil)
close: function()
end
websocket: function(
url: string,
headers: {string: string} | nil
): Websocket | boolean, nil | string
websocketAsync: function(
url: string,
headers: {string: string} | nil
)
end

4
lua/types/parallel.d.tl Normal file
View File

@@ -0,0 +1,4 @@
global record parallel
waitForAny: function(...: function)
waitForAll: function(...: function)
end

33
lua/types/shell.d.tl Normal file
View File

@@ -0,0 +1,33 @@
global record shell
execute: function(command: string, ...: string): boolean
run: function(...: string): boolean
exit: function()
dir: function(): string
setDir: function(dir: string)
path: function(): string
setPath: function(path: string)
resolve: function(path: string): string
resolveProgram: function(command: string): string | nil
programs: function(include_hidden: boolean | nil): {string}
complete: function(sLine: string): {string} | nil
completeProgram: function(program: string): {string}
type _CompletionFunction = function(
shell: table,
index: integer,
argument: string,
previous: {string}
): {string} | nil
setCompletionFunction: function(program: string, complete: _CompletionFunction)
record _CompletionInfo
fnComplete: function
end
getCompletionInfo: function(): {string: _CompletionInfo}
getRunningProgram: function(): string
setAlias: function(command: string, program: string)
clearAlias: function(command: string)
aliases: function(): {string:string}
openTab: function(...: string): integer
switchTab: function(id: integer)
end

65
lua/types/term.d.tl Normal file
View File

@@ -0,0 +1,65 @@
global record term
record Redirect
write: function(text: string)
blit: function(text: string, textColor: string, backgroundColor: string)
scroll: function(y: integer)
clear: function()
clearLine: function()
getCursorPos: function(): integer, integer
setCursorPos: function(x: integer, y: integer)
getCursorBlink: function(): boolean
setCursorBlink: function(blink: boolean)
getSize: function(): integer, integer
isColor: function(): boolean
isColour: function(): boolean
getTextColor: function(): number
getTextColour: function(): number
setTextColor: function(color: number)
setTextColour: function(colour: number)
getBackgroundColor: function(): number
getBackgroundColour: function(): number
setBackgroundColor: function(color: number)
setBackgroundColour: function(colour: number)
getPaletteColor: function(color: number): number, number, number
getPaletteColour: function(colour: number): number, number, number
setPaletteColour: function(color: number, r_rgb: number, g: number | nil, b: number | nil)
setPaletteColor: function(colour: number, r_rgb: number, g: number | nil, b: number | nil)
end
write: function(text: string)
blit: function(text: string, textColor: string, backgroundColor: string)
scroll: function(y: integer)
clear: function()
clearLine: function()
getCursorPos: function(): integer, integer
setCursorPos: function(x: integer, y: integer)
getCursorBlink: function(): boolean
setCursorBlink: function(blink: boolean)
getSize: function(): integer, integer
isColor: function(): boolean
isColour: function(): boolean
getTextColor: function(): number
getTextColour: function(): number
setTextColor: function(color: number)
setTextColour: function(colour: number)
getBackgroundColor: function(): number
getBackgroundColour: function(): number
setBackgroundColor: function(color: number)
setBackgroundColour: function(colour: number)
getPaletteColor: function(color: number): number, number, number
getPaletteColour: function(colour: number): number, number, number
setPaletteColour: function(color: number, r_rgb: number, g: number | nil, b: number | nil)
setPaletteColor: function(colour: number, r_rgb: number, g: number | nil, b: number | nil)
nativePaletteColor: function(color: number): number, number, number
nativePaletteColour: function(colour: number): number, number, number
redirect: function(target: Redirect): Redirect
current: function(): Redirect
native: function(): Redirect
end

39
lua/types/window.d.tl Normal file
View File

@@ -0,0 +1,39 @@
global record window
record Window
write: function(text: string)
blit: function(text: string, textColor: string, backgroundColor: string)
scroll: function(y: integer)
clear: function()
clearLine: function()
getCursorPos: function(): integer, integer
setCursorPos: function(x: integer, y: integer)
getCursorBlink: function(): boolean
setCursorBlink: function(blink: boolean)
getSize: function(): integer, integer
isColor: function(): boolean
isColour: function(): boolean
getTextColor: function(): number
getTextColour: function(): number
setTextColor: function(color: number)
setTextColour: function(colour: number)
getBackgroundColor: function(): number
getBackgroundColour: function(): number
setBackgroundColor: function(color: number)
setBackgroundColour: function(colour: number)
getPaletteColor: function(color: number): number, number, number
getPaletteColour: function(colour: number): number, number, number
setPaletteColour: function(color: number, r_rgb: number, g: number | nil, b: number | nil)
setPaletteColor: function(colour: number, r_rgb: number, g: number | nil, b: number | nil)
getLine: function(y: integer): string, string, string
setVisible: function(visible: boolean)
isVisible: function(): boolean
redraw: function()
getPosition: function(): integer, integer
reposition: function(new_x: integer, new_y: integer, new_width: integer | nil, new_height: integer | nil, new_parent: term.Redirect | nil)
end
create: function(parent: term.Redirect, x: integer, y: integer, width: integer, height: integer, startVisible: boolean | nil): Window
end