@tilua-types/sunc
v4.0.0
Published
The script-executor environment as tilua types: sUNC and UNC names (getgenv, writefile, hookfunction, Drawing, ...)
Readme
@tilua-types/sunc
The script-executor environment as tilua types — the functions an executor
injects into a script's globals: getgenv, writefile, hookfunction,
getconnections, Drawing, request and the rest.
Names and shapes follow sUNC (senS' Unified Naming
Convention) and the UNC standard
it grew out of. Where the two disagree, sUNC's shape is the one written down;
where only UNC has a name (crypt, the rconsole family, mouse input), it is
kept, since executors still expose it.
Depends on @tilua-types/roblox, which is loaded along with it:
nearly every one of these takes or returns an engine type.
npm i -D @tilua-types/sunc{ "types": ["sunc"], "paths": {}, "sourceMap": null }What you get
- The globals, typed.
readfilegives astring,listfilesastring[],getgenv()a{ [string]: unknown }you can write to. Drawing.newknows its shapes. The argument picks the type:Drawing.new("Circle").Radiusis a number,Drawing.new("Line").Fromis aVector2, and asking a line for its radius is an error.- Hooks keep the type they replace.
hookfunction(f, hook)returnsf's own type, so the saved original is still called the wayfwas. debugadds to Lua's.debug.getconstantsanddebug.tracebackare both there: a library that declares a name again extends it.- Signals.
getconnections(part.Touched)givesConnection[], each withFunction,Thread,Fire,Disconnectand the rest.
Caveats
No executor implements all of this, and several names mean slightly different things between them — the types say what the standard says, not what any one executor does. Nothing here exists in a normal Roblox game: a script using these runs only under an executor.
