typescript-to-lua
Advanced tools
Changelog
0.40.0
Added support for using external Lua code in your project. This means you can create and install node_modules packages containing Lua code. It also lets you include Lua source files as part of your source files. Used Lua will automatically be added to your output. For more information, see the External Lua Code page in the docs.
[Breaking] Removed support for deprecated annotations that have been replaced with language extensions: /** @luaIterator */
, /** @vararg */
, /** @luatable */
and /** forRange */
. If you were still using these, see the docs for instructions how to upgrade.
Added support for array.entries()
.
Added support for LuaTable.has(key)
and LuaTable.delete(key)
to the language extensions. See docs for more info.
Made language extension types more strict, disallowing null
and undefined
in some places where they would cause problems in Lua.
Fixed an issue where using TypeScript transformer plugins would cause invalid namespace and module code, as well as breaking hoisting.
Fixed invalid switch statement output when the default
clause was not the last clause in the switch.
Fixed missing LuaLib dependency when using string.split
.
Fixed lots of bundling bugs and issues, also added the TypeScriptToLua header to the top of the bundle unless noHeader is specified.
Under the hood:
Changelog
0.39.0
@phantom
, @metaExtension
, @extension
, @pureAbstract
compiler annotations. As of this version these will no longer function! For help upgrading your code see the deprecated annotation docs.LuaTable<TKey, TValue>
language extension. This allows the use of barebones Lua tables for key-value storage, without suffering from JS's forced string indexes. For more information see the LuaTable docs.@vararg
. Instead, tstl will figure out itself when use of the Lua ellipsis token (...
) is appropriate. Also language extension $vararg
was added to force use of the ellipsis token. See the docs for more information.trailingComments
and leadingComments
fields to statements in the Lua AST. These can be modified by plugins to emit comments in the output lua. For an example see the add-comments test plugin.Under the hood:
Changelog
0.38.0
MultiReturn
to LuaMultiReturn
to be consistent with other language extensions all starting with Lua-.LuaMultiReturn
, including its value not correctly being wrapped in some cases.LuaMultiReturn
values without destructing.+
,-
,..
. For more information see Operator Map Types.$range()
. This function can be used to create numeric lua loops, for example for (const i of $range(1, 10)) {
translates to for i=1,10 do
. For more information see $range Iterator Function.Array.isArray
, formalizing tstl's isArray convention (note: Due to []
and {}
being the same in Lua, {}
- without any keys - is considered an array too.)string.prototype.includes
.string.prototype.split
.a?.b
).