TypeScriptToLua plugin that renames the ___exports
variable.
local ____exports = {}
____exports.foo = 10
____exports.bar = function(self)
...
end
return ____exports
Becomes:
local M = {}
M.foo = 10
M.bar = function(self)
...
end
return M
Requires TSTL >= 1.22.0.
- Install this plugin
yarn add git+https://git@github.com/thinknathan/tstl-export-rename.git#^1.0.0 -D
# or
npm install git+https://git@github.com/thinknathan/tstl-export-rename.git#^1.0.0 --save-dev
-
Add
tstl-export-rename
totstl.luaPlugins
intsconfig.json
-
Define
match
, which will only apply the transformation to files if their output (Lua file) path matches. -
Define
exportRename
, which will be used to replace___exports
{
"tstl": {
"luaPlugins": [
+ {
+ "name": "tstl-export-rename",
+ "match": ".*\\..*.lua$",
+ "exportRename": "M"
+ }
],
}
}
CC0