js2lua repo.
Most of the things are easily translated without any problem, but there are a couple of cases where some special attention is required. This list might grow or shrink depending on whatever I find.
js2lua --no-optionName file.js
, i.e js2lua --no-index0to1 file.js
Default options:
const defaultOptions = {
debug: false,
importStatementHoisting: true,
transformToString: true,
transformString: true,
transformJSONStringify: true,
transformJSONParse: true,
transformParseFloat: true,
transformParseInt: true,
transformNumber: true,
transformIsArray: true,
transformConsoleLog: true,
moduleExportsToReturn: true,
index0To1: true,
tryTranslateClass: true,
disableUpdateExpressionCallback: true,
renameCatchErrorIfNeeded: true,
disableClassCall: true,
};
some.func();
new some.func();
some:func()
some.func()
func([ "someval" ]);
func({ "someval" })
string.prototype.replace = function() {}
function string:replace() end
AFAK not possible
for (let [key, value] in tbl) {}
for key, value, __ in pairs(tbl) do end
Default case must be there and must have break in it otherwise it'll loop forever