Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DPS2004/z8lua-pd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

z8lua

This is a fork of Lua that implements the PICO-8 dialect and adds useful features for emulator implementations.

Branches

The main zepto8 branch is a composite branch built from several feature branches. Please try to submit patches and PRs against the corresponding feature branch instead of zepto8.

There are three main feature branches:

  • pico8: this is a “clean” branch that only implements the PICO-8 syntax and type system, with no extra fancy features; a good start if you’re writing your own emulator.
  • eris: a branch imported from the eris persistence patch with bug fixes and improvements (my pull requests have received little attention so far); this library provides serialisable snapshots of the Lua state (quite useful for emulators).
  • oua: experimental branch allowing to switch on-the-fly to zero-based indices in Lua, using the base(0) function and back with base(1). I call this the Oua language.

PICO-8 features

  • short if syntax (on one line)
  • short print syntax (? at the beginning of a line)
  • compound assignment operators: += /= etc.
  • C style not equal operator: !=
  • C++ style comments with //
  • fixed-point arithmetic with overflows, infinity etc.
  • the PICO-8 math library (shr, atan2, flr etc.)
  • binary literals: 0b1001001.10010
  • works in Windows, Linux, OS X, and many embedded systems

Limitations

  • Lua functions that rely on the PICO-8 state, particularly the VM memory, are beyond the scope of this software; for a more complete PICO-8 implementation, see the zepto8 emulator which is based on z8lua. The only exceptions are the @, % and $ operators (see next section).
  • the sqrt, sin, cos and atan2 functions are implemented using floating point, which is inelegant and a potential performance issue, but which also means the results are not bit-by-bit equivalent to the original PICO-8.

API extensions

LUA_API void lua_setpico8memory (lua_State *L, unsigned char const *p);

Provide the Lua VM with a 64-KiB address space for use with the @, % and $ operators (shorthands for peek, peek2, and peek4). Otherwise these operators will always return 0.

About

Modification of z8lua so it compiles on Playdate

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 95.6%
  • C++ 3.6%
  • Makefile 0.8%