@xiangnanscu/js2lua
v0.48.0
Published
Writing LuaJIT with the expressiveness of JavaScript.
Readme
js2lua
js2lua Writing LuaJIT with the expressiveness of JavaScript.
Install
npm install @xiangnanscu/js2luaUsage
command
Concat one or more js files and transform them to one lua string:
js2lua [options] file1, file2, ...where options are:
const defaultOptions = {
tagArrayExpression: true,
importStatementHoisting: true,
transform$SymbolToDollar: 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,
};examples
Basic:
js2lua foo.js > foo.luaTo disable a feature --no-[option]:
js2lua --no-transformToString foo.jsTo enable a feature --[option]:
js2lua --debug foo.jsapi
import { js2lua } from "js2lua";
js2lua(`let a = 1`, { importStatementHoisting: true });see also
lua2js transform lua to js
lua-resty-array lua version of JS Array (feature tagArrayExpression)
Features
[CODE_TABLE]
