Lua librarys in TypeScript
TypeScript implementations of 16 Lua standard library functions across 2 modules. Each function is individually importable and tree-shakeable.
math stringWe have 16 Lua functions so far - help us add more
Got a rainy Sunday afternoon and a taste for a porting puzzle?
- Get inspiration from the Lua 5.4 manual.
- Click "New file" in the appropriate folder on GitHub. This will fork the project to your account, directly add the file to it, and send a Pull Request to us.
We will then review it. If it's useful to the project and in line with our contributing guidelines your work will become part of Locutus and you'll be automatically credited in the authors section accordingly.
Upstream Surface Inventory 16/157 shipped · 36 next 10%
Locutus tracks 11 upstream namespaces for Lua and sorts them into what is already shipped, what we still want, what we intentionally keep, and what still needs a decision.
This inventory now tracks Lua's core plain-value libraries plus the environment-facing standard tables, not the full host runtime.
In progress
Next
Lua string helpers are strong plain-value portability targets.
bytecharfindformatmatch
Explicit non-goals (5)
-
dumpBytecode dumping is not a good security or portability target. -
gmatchIterator-returning APIs do not fit Locutus' plain-value model. -
packBinary packing semantics do not map cleanly to JS plain values. -
packsizeBinary packing semantics do not map cleanly to JS plain values. -
unpackBinary packing semantics do not map cleanly to JS plain values.
Next
Lua math helpers map cleanly to JS numbers.
acosasinatanatan2coshdegexpfmodfrexpldexploglog10modfpowradrandomsinhtantanhtointegerult
Explicit non-goals (1)
-
randomseedGlobal RNG seeding mutates ambient runtime state.
utf8
Next
UTF-8 codepoint helpers have a strong plain-value string and numeric contract.
charcodepointlenoffset
Explicit non-goals (1)
-
codesIterator-returning APIs do not fit Locutus' current plain-value model.
os
Next
Date formatting and decomposition still have a useful plain-value contract.
date
Time-difference helpers have a clean plain-value contract.
difftime
Unix-time conversion has a clean plain-value contract.
time
Explicit non-goals (8)
-
clockMost os helpers depend on host environment, clocks, or filesystem state. -
executeProcess spawning is outside Locutus' portability scope. -
exitProcess termination is outside Locutus' value-only model. -
getenvEnvironment lookup depends on host runtime state. -
removeFilesystem mutation is outside Locutus' portability scope. -
renameFilesystem mutation is outside Locutus' portability scope. -
setlocaleLocale mutation changes ambient runtime behavior. -
tmpnameTemporary-path generation depends on host state.
table
Next
String joining over list-like tables has a clean plain-value contract.
concat
Packing variadic values into a list-like table is a useful portability target.
pack
Table expansion still has a useful plain-value contract for parity and examples.
unpack
Explicit non-goals (4)
-
insertMost table helpers mutate caller-owned tables rather than returning plain immutable values. -
moveMost table helpers mutate caller-owned tables rather than returning plain immutable values. -
removeMost table helpers mutate caller-owned tables rather than returning plain immutable values. -
sortMost table helpers mutate caller-owned tables rather than returning plain immutable values.