mwg API
    Preparing search index...

    Function luaToJs

    • Translates Lua source to readable JavaScript without running it, for a game that is leaving Lua scripting behind. Metatables, coroutines, general goto and some patterns are not translated: they stay as TODO(lua2js) comments and warnings. Throws a LuaSyntaxError for source that does not parse.

      Parameters

      • source: string
      • options: LuaToJsOptions = {}

      Returns LuaToJsResult

      import { luaToJs } from '@datamoc/mwg/mwl/pyroeis';

      const { code } = luaToJs('function double(n) return n * 2 end', { format: 'esm' });