0.31.0 • Published 3 months ago

@xiangnanscu/js2lua v0.31.0

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

js2lua

js2lua Writing LuaJIT with the expressiveness of JavaScript.

Install

npm install -g @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 = {
  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,
};

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

lua2js transform lua to js

Features

CODE_TABLE

0.31.0

3 months ago

0.30.0

3 months ago

0.24.0

3 months ago

0.22.0

8 months ago

0.21.0

8 months ago

0.20.0

8 months ago

0.19.0

8 months ago

0.18.0

8 months ago

0.17.0

8 months ago

0.16.0

8 months ago

0.15.0

8 months ago

0.14.0

8 months ago

0.13.0

8 months ago

0.12.0

8 months ago

0.11.0

8 months ago

0.10.0

8 months ago

0.9.0

8 months ago