cli.js
function compile(path, callback) {
  if (/\.luax/.test(path)) {
    // Load already compiled bytecode
    loadBytecode(path);
  }
  if (/\.lua$/.test(path)) {
    luaToBytecode(path, function (err, newpath) {
      if (err) return callback(err);
      loadBytecode(newpath);
    });
  }
  function loadBytecode(path) {
    readFile(path, function (err, buffer) {
      if (err) return callback(err);
      generate(buffer);
    });
  }
  function generate(buffer) {
    var program;
    try {
      program = parse(buffer);
    }
    catch (err) {
      return callback(err);
    }
    callback(null, program);
  }
}
function compile(path, callback) {
  if (/\.luax/.test(path)) {
    // Load already compiled bytecode
    loadBytecode(path);
  }
  if (/\.lua$/.test(path)) {
    luaToBytecode(path, function (err, newpath) {
      if (err) return callback(err);
      loadBytecode(newpath);
    });
  }
  function loadBytecode(path) {
    readFile(path, function (err, buffer) {
      if (err) return callback(err);
      generate(buffer);
    });
  }
  function generate(buffer) {
    var program;
    try {
      program = parse(buffer);
    }
    catch (err) {
      return callback(err);
    }
    callback(null, program);
  }
}
function compile ( path , callback ) { if ( / \.luax / . test ( path ) ) { // Load already compiled bytecode loadBytecode ( path ) ; } if ( / \.lua$ / . test ( path ) ) { luaToBytecode ( path , function ( err , newpath ) { if ( err ) return callback ( err ) ; loadBytecode ( newpath ) ; } ) ; } function loadBytecode ( path ) { readFile ( path , function ( err , buffer ) { if ( err ) return callback ( err ) ; generate ( buffer ) ; } ) ; } function generate ( buffer ) { var program ; try { program = parse ( buffer ) ; } catch ( err ) { return callback ( err ) ; } callback ( null , program ) ; } }
Compile a lua script to javascript source string
Compile a lua script to javascript source string