@xiangnanscu/lua2js
v0.34.0
Published
[@xiangnanscu/lua2js](https://xiangnanscu.github.io/lua2js/) transform lua to js literally.
Downloads
37
Readme
@xiangnanscu/lua2js
@xiangnanscu/lua2js transform lua to js literally.
Install
npm install -g @xiangnanscu/lua2jsUsage
command
Concat one or more js files and transform them to one lua string:
lua2js [options] file1, file2, ...where options are:
const defaultOptions = {
printToConsoleLog: true,
tryUseOfLoop: true,
indexMinusOne: false,
returnNilToThrow: false,
errorToThrow: true,
tostring: true,
dict: false,
list: false,
unpack: true,
tonumber: true,
class: false,
selfToThis: true,
clsToThis: true,
typeToTypeof: true,
stringFormat: false,
tableConcat: false,
tableInsert: false,
camelStyle: false,
};examples
Basic:
lua2js foo.lua > foo.jsTo disable a feature --no-[option]:
lua2js --no-camelStyle foo.luaTo enable a feature --[option]:
lua2js --camelStyle foo.luaapi
import { lua2js } from "lua2js";
const jscode = lua2js(`local snake_var = 1`, { camelStyle: true });
// let snakeVar = 1;see also
@xiangnanscu/js2lua transform js to lua
