Skip to content

Instantly share code, notes, and snippets.

@anosatsuk124
Last active April 4, 2026 03:02
Show Gist options
  • Select an option

  • Save anosatsuk124/58d4932870f682f58f73306a384bb2be to your computer and use it in GitHub Desktop.

Select an option

Save anosatsuk124/58d4932870f682f58f73306a384bb2be to your computer and use it in GitHub Desktop.
-- CC: Tweaked type definitions for Teal
-- Reference: https://tweaked.cc/
-- Enums
global enum Side
"left"
"right"
"top"
"bottom"
"front"
"back"
end
global type Color = integer
global enum SeekWhence
"set"
"cur"
"end"
end
-- File Handle records
global record ReadHandle
read: function(self, count?: integer): string | integer
readAll: function(self): string
readLine: function(self, with_trailing?: boolean): string
seek: function(self, whence?: SeekWhence, offset?: integer): integer, string
close: function(self)
end
global record WriteHandle
write: function(self, contents: string | integer)
writeLine: function(self, text: string)
flush: function(self)
seek: function(self, whence?: SeekWhence, offset?: integer): integer, string
close: function(self)
end
global record ReadWriteHandle
read: function(self, count?: integer): string | integer
readAll: function(self): string
readLine: function(self, with_trailing?: boolean): string
write: function(self, contents: string | integer)
writeLine: function(self, text: string)
flush: function(self)
seek: function(self, whence?: SeekWhence, offset?: integer): integer, string
close: function(self)
end
-- HTTP records
global record Response
read: function(self, count?: integer): string | integer
readAll: function(self): string
readLine: function(self, with_trailing?: boolean): string
seek: function(self, whence?: SeekWhence, offset?: integer): integer, string
close: function(self)
getResponseCode: function(self): integer, string
getResponseHeaders: function(self): {string:string}
end
global record Websocket
receive: function(self, timeout?: number): string, boolean, string
send: function(self, message: string, binary?: boolean)
close: function(self)
end
global record HttpRequestOptions
url: string
body: string
headers: {string:string}
binary: boolean
method: string
redirect: boolean
timeout: number
end
global record WebsocketOptions
url: string
headers: {string:string}
timeout: number
end
-- Terminal records
global record Redirect
write: function(self, text: string)
scroll: function(self, n: integer)
getCursorPos: function(self): integer, integer
setCursorPos: function(self, x: integer, y: integer)
getCursorBlink: function(self): boolean
setCursorBlink: function(self, blink: boolean)
getSize: function(self): integer, integer
clear: function(self)
clearLine: function(self)
getTextColor: function(self): Color
getTextColour: function(self): Color
setTextColor: function(self, color: Color)
setTextColour: function(self, color: Color)
getBackgroundColor: function(self): Color
getBackgroundColour: function(self): Color
setBackgroundColor: function(self, color: Color)
setBackgroundColour: function(self, color: Color)
isColor: function(self): boolean
isColour: function(self): boolean
blit: function(self, text: string, text_color: string, background_color: string)
setPaletteColor: function(self, color: Color, r: number, g: number, b: number)
setPaletteColour: function(self, color: Color, r: number, g: number, b: number)
getPaletteColor: function(self, color: Color): number, number, number
getPaletteColour: function(self, color: Color): number, number, number
end
global record Window
write: function(self, text: string)
scroll: function(self, n: integer)
getCursorPos: function(self): integer, integer
setCursorPos: function(self, x: integer, y: integer)
getCursorBlink: function(self): boolean
setCursorBlink: function(self, blink: boolean)
getSize: function(self): integer, integer
clear: function(self)
clearLine: function(self)
getTextColor: function(self): Color
getTextColour: function(self): Color
setTextColor: function(self, color: Color)
setTextColour: function(self, color: Color)
getBackgroundColor: function(self): Color
getBackgroundColour: function(self): Color
setBackgroundColor: function(self, color: Color)
setBackgroundColour: function(self, color: Color)
isColor: function(self): boolean
isColour: function(self): boolean
blit: function(self, text: string, text_color: string, background_color: string)
setPaletteColor: function(self, color: Color, r: number, g: number, b: number)
setPaletteColour: function(self, color: Color, r: number, g: number, b: number)
getPaletteColor: function(self, color: Color): number, number, number
getPaletteColour: function(self, color: Color): number, number, number
getLine: function(self, y: integer): string, string, string
setVisible: function(self, visible: boolean)
isVisible: function(self): boolean
redraw: function(self)
restoreCursor: function(self)
getPosition: function(self): integer, integer
reposition: function(self, x: integer, y: integer, width?: integer, height?: integer, parent?: Redirect)
end
-- Vector
global record Vector
x: number
y: number
z: number
add: function(self, other: Vector): Vector
sub: function(self, other: Vector): Vector
mul: function(self, factor: number): Vector
div: function(self, factor: number): Vector
unm: function(self): Vector
dot: function(self, other: Vector): number
cross: function(self, other: Vector): Vector
length: function(self): number
normalize: function(self): Vector
round: function(self, tolerance?: number): Vector
tostring: function(self): string
end
-- Global functions
global sleep: function(time: number)
global printError: function(...: any)
global write: function(text: string): integer
global read: function(replaceChar?: string, history?: {string}, completeFn?: any, default_value?: string): string
-- Module: colors
global record colors
white: Color
orange: Color
magenta: Color
lightBlue: Color
yellow: Color
lime: Color
pink: Color
gray: Color
lightGray: Color
cyan: Color
purple: Color
blue: Color
brown: Color
green: Color
red: Color
black: Color
combine: function(...: Color): Color
subtract: function(colorset: Color, ...: Color): Color
test: function(colorset: Color, color: Color): boolean
packRGB: function(r: number, g: number, b: number): integer
unpackRGB: function(rgb: integer): number, number, number
rgb8: function(r: integer, g: integer, b: integer): integer
end
global record colours
white: Color
orange: Color
magenta: Color
lightBlue: Color
yellow: Color
lime: Color
pink: Color
gray: Color
grey: Color
lightGray: Color
lightGrey: Color
cyan: Color
purple: Color
blue: Color
brown: Color
green: Color
red: Color
black: Color
combine: function(...: Color): Color
subtract: function(colorset: Color, ...: Color): Color
test: function(colorset: Color, color: Color): boolean
packRGB: function(r: number, g: number, b: number): integer
unpackRGB: function(rgb: integer): number, number, number
rgb8: function(r: integer, g: integer, b: integer): integer
end
-- Module: vector
global record vector
new: function(x: number, y: number, z: number): Vector
end
-- Module: fs
global record fs
list: function(path: string): {string}
exists: function(path: string): boolean
isDir: function(path: string): boolean
isReadOnly: function(path: string): boolean
makeDir: function(path: string)
move: function(from: string, to: string)
copy: function(from: string, to: string)
delete: function(path: string)
combine: function(base: string, local_part: string): string
getName: function(path: string): string
getDir: function(path: string): string
getSize: function(path: string): integer
getDrive: function(path: string): string
getFreeSpace: function(path: string): integer | string
getCapacity: function(path: string): integer | nil
open: function(path: string, mode: string): any, string
find: function(wildcard: string): {string}
attributes: function(path: string): {string:any}
complete: function(path: string, location: string, include_files?: boolean, include_dirs?: boolean): {string}
isDriveRoot: function(path: string): boolean
end
-- Module: term
global record term
native: function(): Redirect
write: function(text: string)
scroll: function(n: integer)
getCursorPos: function(): integer, integer
setCursorPos: function(x: integer, y: integer)
getCursorBlink: function(): boolean
setCursorBlink: function(blink: boolean)
getSize: function(): integer, integer
clear: function()
clearLine: function()
getTextColor: function(): Color
getTextColour: function(): Color
setTextColor: function(color: Color)
setTextColour: function(color: Color)
getBackgroundColor: function(): Color
getBackgroundColour: function(): Color
setBackgroundColor: function(color: Color)
setBackgroundColour: function(color: Color)
isColor: function(): boolean
isColour: function(): boolean
blit: function(text: string, text_color: string, background_color: string)
setPaletteColor: function(color: Color, r: number, g: number, b: number)
setPaletteColour: function(color: Color, r: number, g: number, b: number)
getPaletteColor: function(color: Color): number, number, number
getPaletteColour: function(color: Color): number, number, number
redirect: function(target: Redirect): Redirect
current: function(): Redirect
end
-- Module: window
global record window
create: function(parent: Redirect, x: integer, y: integer, width: integer, height: integer, start_visible?: boolean): Window
end
-- Module: shell
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
aliases: function(): {string:string}
setAlias: function(alias: string, program: string)
clearAlias: function(alias: string)
programs: function(include_hidden?: boolean): {string}
getRunningProgram: function(): string
complete: function(prefix: string): {string}
completeProgram: function(prefix: string): {string}
switchTab: function(id: integer)
openTab: function(...: string): integer
end
-- Module: textutils
global record textutils
empty_json_array: {any}
json_null: {any}
slowWrite: function(text: string, rate?: number)
slowPrint: function(text: string, rate?: number)
formatTime: function(time: number, twenty_four_hour?: boolean): string
pagedPrint: function(text: string, free_lines?: integer): integer
tabulate: function(...: any)
pagedTabulate: function(...: any)
serialize: function(value: any, opts?: {string:any}): string
serialise: function(value: any, opts?: {string:any}): string
unserialize: function(value: string): any
unserialise: function(value: string): any
serializeJSON: function(value: any, opts?: boolean | {string:any}): string
serialiseJSON: function(value: any, opts?: boolean | {string:any}): string
unserializeJSON: function(value: string, opts?: {string:any}): any, string
unserialiseJSON: function(value: string, opts?: {string:any}): any, string
urlEncode: function(value: string): string
complete: function(partial: string, possible: {string}): {string}
end
-- Module: turtle
global record turtle
forward: function(): boolean, string
back: function(): boolean, string
up: function(): boolean, string
down: function(): boolean, string
turnLeft: function(): boolean, string
turnRight: function(): boolean, string
dig: function(side?: string): boolean, string
digUp: function(side?: string): boolean, string
digDown: function(side?: string): boolean, string
place: function(text?: string): boolean, string
placeUp: function(text?: string): boolean, string
placeDown: function(text?: string): boolean, string
attack: function(side?: string): boolean, string
attackUp: function(side?: string): boolean, string
attackDown: function(side?: string): boolean, string
detect: function(): boolean
detectUp: function(): boolean
detectDown: function(): boolean
inspect: function(): boolean, {string:any} | string
inspectUp: function(): boolean, {string:any} | string
inspectDown: function(): boolean, {string:any} | string
select: function(slot: integer): boolean
getSelectedSlot: function(): integer
getItemCount: function(slot?: integer): integer
getItemSpace: function(slot?: integer): integer
getItemDetail: function(slot?: integer, detailed?: boolean): {string:any}
compare: function(): boolean
compareUp: function(): boolean
compareDown: function(): boolean
compareTo: function(slot: integer): boolean
transferTo: function(slot: integer, count?: integer): boolean
drop: function(count?: integer): boolean, string
dropUp: function(count?: integer): boolean, string
dropDown: function(count?: integer): boolean, string
suck: function(count?: integer): boolean, string
suckUp: function(count?: integer): boolean, string
suckDown: function(count?: integer): boolean, string
craft: function(limit?: integer): boolean, string
refuel: function(count?: integer): boolean, string
getFuelLevel: function(): integer | string
getFuelLimit: function(): integer | string
equipLeft: function(): boolean, string
equipRight: function(): boolean, string
getEquippedLeft: function(): string
getEquippedRight: function(): string
native: any
end
-- Module: peripheral
global record peripheral
isPresent: function(name: string): boolean
getType: function(name: string): string | {string}
hasType: function(name: string, ty: string): boolean
getMethods: function(name: string): {string}
call: function(name: string, method: string, ...: any): any
wrap: function(name: string): any
find: function(ty: string, filter?: function(name: string, wrapped: any): boolean): any
getNames: function(): {string}
end
-- Module: rednet
global record rednet
CHANNEL_BROADCAST: integer
CHANNEL_REPEAT: integer
MAX_ID_CHANNELS: integer
open: function(modem: Side)
close: function(modem?: Side)
isOpen: function(modem?: Side): boolean
send: function(recipient: integer, message: any, protocol?: string): boolean
broadcast: function(message: any, protocol?: string)
receive: function(protocol_filter?: string, timeout?: number): integer, any, string
host: function(protocol: string, hostname: string)
unhost: function(protocol: string)
lookup: function(protocol: string, hostname?: string): integer | {integer}
end
-- Module: gps
global record gps
CHANNEL_GPS: integer
locate: function(timeout?: number, debug?: boolean): number, number, number
end
-- Module: http
global record http
get: function(url: string | HttpRequestOptions, headers?: {string:string}, binary?: boolean): Response, string, Response
post: function(url: string | HttpRequestOptions, body?: string, headers?: {string:string}, binary?: boolean): Response, string, Response
request: function(url: string | HttpRequestOptions, body?: string, headers?: {string:string}, binary?: boolean): boolean, string
checkURLAsync: function(url: string): boolean, string
checkURL: function(url: string): boolean, string
websocketAsync: function(url: string | WebsocketOptions, headers?: {string:string}): boolean, string
websocket: function(url: string | WebsocketOptions, headers?: {string:string}): Websocket, string
end
-- Module: os
global record os
pullEvent: function(filter?: string): string, any, any, any, any
pullEventRaw: function(filter?: string): string, any, any, any, any
sleep: function(time: number)
version: function(): string
run: function(env: {string:any}, path: string, ...: any): boolean
queueEvent: function(name: string, ...: any)
startTimer: function(time: number): integer
cancelTimer: function(token: integer)
setAlarm: function(time: number): integer
cancelAlarm: function(token: integer)
shutdown: function()
reboot: function()
getComputerID: function(): integer
computerID: function(): integer
getComputerLabel: function(): string | nil
computerLabel: function(): string | nil
setComputerLabel: function(label?: string)
clock: function(): number
time: function(locale?: string): any
day: function(locale?: string): integer
epoch: function(locale?: string): integer
date: function(format?: string, time?: number): any
loadAPI: function(path: string): boolean
unloadAPI: function(name: string)
end
-- Module: redstone
global record redstone
getSides: function(): {string}
setOutput: function(side: string, on: boolean)
getOutput: function(side: string): boolean
getInput: function(side: string): boolean
setAnalogOutput: function(side: string, value: integer)
setAnalogueOutput: function(side: string, value: integer)
getAnalogOutput: function(side: string): integer
getAnalogueOutput: function(side: string): integer
getAnalogInput: function(side: string): integer
getAnalogueInput: function(side: string): integer
setBundledOutput: function(side: string, output: integer)
getBundledOutput: function(side: string): integer
getBundledInput: function(side: string): integer
testBundledInput: function(side: string, mask: integer): boolean
end
global record rs
getSides: function(): {string}
setOutput: function(side: string, on: boolean)
getOutput: function(side: string): boolean
getInput: function(side: string): boolean
setAnalogOutput: function(side: string, value: integer)
setAnalogueOutput: function(side: string, value: integer)
getAnalogOutput: function(side: string): integer
getAnalogueOutput: function(side: string): integer
getAnalogInput: function(side: string): integer
getAnalogueInput: function(side: string): integer
setBundledOutput: function(side: string, output: integer)
getBundledOutput: function(side: string): integer
getBundledInput: function(side: string): integer
testBundledInput: function(side: string, mask: integer): boolean
end
-- Module: disk
global record disk
isPresent: function(name: string): boolean
getLabel: function(name: string): string | nil
setLabel: function(name: string, label?: string)
hasData: function(name: string): boolean
getMountPath: function(name: string): string | nil
hasAudio: function(name: string): boolean
getAudioTitle: function(name: string): string | boolean | nil
playAudio: function(name: string)
stopAudio: function(name: string)
eject: function(name: string)
getID: function(name: string): integer | nil
end
-- Module: settings
global record settings
define: function(name: string, options?: {string:any})
undefine: function(name: string)
set: function(name: string, value: any)
get: function(name: string, default_value?: any): any
getDetails: function(name: string): {string:any}
unset: function(name: string)
clear: function()
getNames: function(): {string}
load: function(path?: string): boolean
save: function(path?: string): boolean
end
-- Module: keys
global record keys
a: integer
b: integer
c: integer
d: integer
e: integer
f: integer
g: integer
h: integer
i: integer
j: integer
k: integer
l: integer
m: integer
n: integer
o: integer
p: integer
q: integer
r: integer
s: integer
t: integer
u: integer
v: integer
w: integer
x: integer
y: integer
z: integer
zero: integer
one: integer
two: integer
three: integer
four: integer
five: integer
six: integer
seven: integer
eight: integer
nine: integer
f1: integer
f2: integer
f3: integer
f4: integer
f5: integer
f6: integer
f7: integer
f8: integer
f9: integer
f10: integer
f11: integer
f12: integer
f13: integer
f14: integer
f15: integer
f16: integer
f17: integer
f18: integer
f19: integer
f20: integer
f21: integer
f22: integer
f23: integer
f24: integer
f25: integer
numPad0: integer
numPad1: integer
numPad2: integer
numPad3: integer
numPad4: integer
numPad5: integer
numPad6: integer
numPad7: integer
numPad8: integer
numPad9: integer
numPadAdd: integer
numPadSubtract: integer
numPadMultiply: integer
numPadDivide: integer
numPadDecimal: integer
numPadEnter: integer
numPadEqual: integer
numLock: integer
scrollLock: integer
capsLock: integer
leftShift: integer
rightShift: integer
leftCtrl: integer
rightCtrl: integer
leftAlt: integer
rightAlt: integer
space: integer
enter: integer
backspace: integer
tab: integer
minus: integer
equals: integer
leftBracket: integer
rightBracket: integer
backslash: integer
semicolon: integer
apostrophe: integer
grave: integer
comma: integer
period: integer
slash: integer
left: integer
right: integer
up: integer
down: integer
home: integer
["end"]: integer
pageUp: integer
pageDown: integer
insert: integer
delete: integer
pause: integer
menu: integer
printScreen: integer
sysReq: integer
getName: function(code: integer): string | nil
end
-- Module: parallel
global record parallel
waitForAny: function(...: function())
waitForAll: function(...: function())
end
-- Module: paintutils
global record paintutils
parseImage: function(image: string): {any}
loadImage: function(path: string): {any} | nil
drawPixel: function(x: integer, y: integer, color?: Color)
drawLine: function(startX: integer, startY: integer, endX: integer, endY: integer, color?: Color)
drawBox: function(startX: integer, startY: integer, endX: integer, endY: integer, color?: Color)
drawFilledBox: function(startX: integer, startY: integer, endX: integer, endY: integer, color?: Color)
drawImage: function(image: {any}, x: integer, y: integer)
end
-- Module: help
global record help
path: function(): string
setPath: function(path: string)
lookup: function(topic: string): string | nil
topics: function(): {string}
completeTopic: function(prefix: string): {string}
end
-- Module: multishell
global record multishell
getFocus: function(): integer
setFocus: function(n: integer): boolean
getTitle: function(n: integer): string | nil
setTitle: function(n: integer, title: string)
getCurrent: function(): integer
launch: function(env: {string:any}, path: string, ...: any): integer
getCount: function(): integer
end
-- Module: pocket
global record pocket
equipBack: function(): boolean, string
unequipBack: function(): boolean, string
end
-- Module: commands
global record commands
exec: function(command: string): boolean, {string}, integer | nil
execAsync: function(command: string): integer
list: function(...: string): {string}
getBlockPosition: function(): integer, integer, integer
getBlockInfo: function(x: integer, y: integer, z: integer): {string:any}
getBlockInfos: function(minX: integer, minY: integer, minZ: integer, maxX: integer, maxY: integer, maxZ: integer): {{string:any}}
native: any
async: any
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment