Skip to content

API Transforms

JavaScript standard-library APIs are compiled inline — no runtime polyfill package is required. Array and Object helpers that have no direct Luau equivalent are emitted as auto-generated helper functions in the output preamble, included only when used.

TypeScriptLuau
console.log() / console.warn() / console.error()print() / warn()
Math.floor() / Math.PI / Math.*math.floor() / math.pi / math.*
JSON.stringify() / JSON.parse()HttpService:JSONEncode() / JSONDecode()
parseInt() / parseFloat()tonumber()
setTimeout(fn, ms) / clearTimeout(id)task.delay(ms / 1000, fn) / task.cancel(id)
arr.push/pop/shift/includes/indexOfLuau table equivalents
arr.map/filter/reduce/find/some/everyAuto-generated helper functions
arr.slice/splice/flat/flatMap/concat/reverse/fillAuto-generated helper functions
arr.length / str.length# operator
str.toLowerCase/toUpperCase/trim/splitstring.* equivalents
str.includes/startsWith/endsWith/replacestring.find / string.sub / string.gsub
Object.keys/values/entries/assignAuto-generated helpers
Number.isInteger/isNaN/isFiniteInline Luau checks
Array.isArray(x) / Array.from(x)Type check / table conversion
Map/Set .get/.set/.has/.add/.delete/.clear/.sizeTable operations (resolved via the type checker)
/regex/flagsRegExp("regex", "flags") via luau-regexp
v.add/sub/mul/div/idiv(x)v + x / v - x / v * x / v / x / v // x (value-type operators)

JavaScript regex literals (/pattern/flags) and RegExp methods compile to calls into luau-regexp. See the regex example for the full mapping of .test, .exec, .match, and .replace.

Since TypeScript lacks operator overloading, Roblox value types expose arithmetic as methods that compile to native Luau operators:

const moved = position.add(offset); // → position + offset
const scaled = size.mul(2); // → size * 2