TypeScriptToLua plugin that renames the ___exports variable for cosmetic reasons.
❗ Use this and any code transformation plugin with caution. Mistakes are possible.
local ____exports = {}
____exports.foo = 10
____exports.bar = function(self)
...
end
return ____exportsBecomes:
local M = {}
M.foo = 10
M.bar = function(self)
...
end
return MRequires TSTL >= 1.22.0.
- Install this plugin
yarn add tstl-export-rename -D
# or
npm install tstl-export-rename --save-dev-
Add
tstl-export-renametotstl.luaPluginsintsconfig.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