lua-format

1.4.1 • Public • Published

luamin-logo

luamin.js (a.k.a. lua-format)

Luamin is a Lua Beautifier & Minifier, written in pure JavaScript. Supports Lua 5.1 - 5.4, FiveM hashed strings & a touch of Luau

const luamin = require('lua-format')

const code = `print("hello world!")`
const source = luamin.Beautify(code, {
  RenameVariables: true,
  RenameGlobals: false,
  SolveMath: true
})

Installation

Luamin is a Node.js module installed through npm. To start using Luamin, download and install Node.js.

Installation is done using npm install command:

$ npm install lua-format

Feautures

  • Prettifier
  • Minifier
  • Simplifier (SolveMath)

Quick Start

const luamin = require('lua-format')

const Code = `print("hello world!")`
const Settings = {
  RenameVariables: true,
  RenameGlobals: false,
  SolveMath: true
}

const Beautified = luamin.Beautify(Code, Settings)
const Minified = luamin.Minify(Code, Settings)
const Uglified = luamin.Uglify(Code, Settings)

Example output

Beautifier (with SolveMath & RenameGlobals enabled)

input:

local IiIiiIi = 0; IiiiIiI = 'hi' .. ' mom'; iIIIiI = 5 + 2;

output:

local L_1_ = 0;
G_1_ = "hi mom";
G_2_ = 7;

Minifier (with RenameGlobals enabled)

input:

local L_1_ = 0;
G_1_ = "hi mom";
G_2_ = 7;

output:

local c=0;a="hi mom"b=7

License

ISC

Package Sidebar

Install

npm i lua-format

Weekly Downloads

183

Version

1.4.1

License

ISC

Unpacked Size

1.68 MB

Total Files

11

Last publish

Collaborators

  • herrtt