JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q45821F
  • License MIT

A javascript to PICO-8 LUA converter

Package Exports

  • @jspicl/core
  • @jspicl/core/pic8-api.d.ts
  • @jspicl/core/types

Readme

@jspicl/core

The core transpiler library for jspicl. Converts JavaScript to PICO-8 Lua.

Installation

npm install @jspicl/core

Usage

import {jspicl} from "@jspicl/core";

const javascript = `
function _init() {
  x = 64;
  y = 64;
}

function _update() {
  if (btn(0)) x -= 1;
  if (btn(1)) x += 1;
  if (btn(2)) y -= 1;
  if (btn(3)) y += 1;
}

function _draw() {
  cls();
  circfill(x, y, 4, 8);
}
`;

const result = jspicl(javascript);
console.log(result.code);
// Output: Lua code ready for PICO-8

console.log(result.polyfills);
// Output: Any required polyfill implementations

Visit jspicl.github.io for detailed documentation.