|
| 1 | +# z8lua |
| 2 | + |
| 3 | +This is a fork of Lua that implements the PICO-8 dialect and adds useful features for |
| 4 | +emulator implementations. |
| 5 | + |
| 6 | +### Branches |
| 7 | + |
| 8 | +The main `zepto8` branch is a composite branch built from several feature branches. Please |
| 9 | +try to submit patches and PRs against the corresponding feature branch instead of `zepto8`. |
| 10 | + |
| 11 | +There are three main feature branches: |
| 12 | + |
| 13 | + - `pico8`: the PICO-8 syntax branch. |
| 14 | + - `eris`: a branch imported from the [eris persistence patch](https://github.com/fnuecke/eris) |
| 15 | + with bug fixes and improvements ([my pull requests have received little attention so |
| 16 | + far](https://github.com/fnuecke/eris/pulls)); this library provides serialisable snapshots |
| 17 | + of the Lua state (quite useful for emulators). |
| 18 | + - `oua`: allow to switch on-the-fly to zero-based indices in Lua, using the `base(0)` function |
| 19 | + and back with `base(1)`. I call this the **Oua** language. |
| 20 | + |
| 21 | +## PICO-8 features |
| 22 | + |
| 23 | + - short `if` syntax (on one line) |
| 24 | + - short `print` syntax (`?` at the beginning of a line) |
| 25 | + - compound assignment operators: `+=` `/=` etc. |
| 26 | + - C style not equal operator: `!=` |
| 27 | + - C++ style comments with `//` |
| 28 | + - fixed-point arithmetic with overflows, infinity etc. |
| 29 | + - the PICO-8 math library (`shr`, `atan2`, `flr` etc.) |
| 30 | + - binary literals: `0b1001001.10010` |
| 31 | + - works in Windows, Linux, OS X, and many embedded systems |
| 32 | + |
| 33 | +## API extensions |
| 34 | + |
| 35 | +```c |
| 36 | +LUA_API void lua_setpico8memory (lua_State *L, unsigned char const *p); |
| 37 | +``` |
| 38 | +
|
| 39 | +Provide the Lua VM with a 64-KiB address space for use with the `@`, `%` and `$` operators |
| 40 | +(shorthands for `peek`, `peek2`, and `peek4`). Otherwise these operators will always return 0. |
0 commit comments