0.48.0 • Published 8 months ago

@xiangnanscu/js2lua v0.48.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

js2lua

js2lua Writing LuaJIT with the expressiveness of JavaScript.

Install

npm install @xiangnanscu/js2lua

Usage

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.lua

To disable a feature --no-[option]:

js2lua --no-transformToString foo.js

To enable a feature --[option]:

js2lua --debug foo.js

api

import { js2lua } from "js2lua";
js2lua(`let a = 1`, { importStatementHoisting: true });

see also

Features

CODE_TABLE

0.42.0

8 months ago

0.43.0

8 months ago

0.41.0

8 months ago

0.37.0

8 months ago

0.36.0

9 months ago

0.48.0

8 months ago

0.46.0

8 months ago

0.47.0

8 months ago

0.44.0

8 months ago

0.45.0

8 months ago

0.35.0

11 months ago

0.34.0

11 months ago

0.31.0

1 year ago

0.30.0

1 year ago

0.24.0

1 year ago

0.22.0

2 years ago

0.21.0

2 years ago

0.20.0

2 years ago

0.19.0

2 years ago

0.18.0

2 years ago

0.17.0

2 years ago

0.16.0

2 years ago

0.15.0

2 years ago

0.14.0

2 years ago

0.13.0

2 years ago

0.12.0

2 years ago

0.11.0

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago