The repository provides the transformer and post-build, pre-build utilities.
These utilities and transformers can be used with TypescriptToLua package.
The transformer provides:
-
TypeScript
importremoving: Result Lua file should not have anyrequirescalls -
TypeScript
export(and inlinedexport) replace: All exported statements will be written to Lua's_G. Example -
File side checking: You cannot mix
import ... from '.../client'andimport ... from '.../server'
Insert into tsconfig.json:
{
"compilerOptions": {
// ...
"plugins": [
{
"transform": "mtasa-lua-utils/transformer",
"after": false,
"externalImports": true, //dont remove non mta imports (Default: false)
"globalExports": false //dont replace exports to global (Default: true)
}
],
// ...
}
}Checks compiled lua files correctness:
- Are the files provided in
meta.xml
Insert into package.json:
{
// ...
"scripts": {
"postbuild": "mtasa-utils-postbuild",
},
// ...
}