Skip to content

Fixes(/tests) from my fork #7

Description

@thisismypassport

Hi,

I've created a fork of z8lua (specifically, the pico8 branch) containing:

  • Some tests for pico8 apis & syntax (not exhaustive)
  • Some fixes to pico8 api issues
  • Some missing syntax & missing apis (some of which you have explicitly decided not to include in your repo, so I don't expect you'll want to take everything)

You (and anyone else who wants it) can find the fork here:
https://github.com/thisismypassport/z8lua
(The goal of the fork is to be able to run pico8 "script" carts [like parens8] in shrinko8)
[note - I used to have something else in this fork, but I moved that to the zepto8 branch, which does NOT contain these fixes]

A detailed list of the fixes/additions, ordered roughly from most to least likely wanted by you:

  • syntax - support nested shorthands
  • syntax - support missing '?' expression (not just statement)
  • syntax - support missing '~' as alias for '^^'
  • syntax - support missing 'if .. do' (as alias for 'if .. then') syntax
  • meta - fixed __rotr metamethod (thanks to siapran's issue for catching this)
  • tonum - fix incorrect flag 0x2 implementation
  • tonum - fix buffer overflow with flag 0x1
  • tonum - support flag 0x4
  • chr - support arbitrary number of parameters
  • ord - do not fail for non-tables
  • ord - [otherwise] always return the number of results requested
  • split - fix for numeric strings to split by (should be treated as a string, not a number)
  • sub - implemented (largely reusing lua's implementation)
  • inext - exposed and changed its implementation to not fail for non-tables (applies also to the result of ipairs)
  • pack/unpack - exposed (reusing lua's implementation)
  • table apis - implemented add/del/deli/count/all/foreach
  • memory - support 64k memory (instead of the old 32k)
  • memory - implement the rest of the apis (not just the peek operators) - peek*/poke*/memcpy/memset.
  • memory - allow use of peek/poke/etc out-of-the-box, without having to call special apis
  • misc apis - exposed coroutine apis with pico8 names (largely untested, but should be roughly compatible)
  • tests that cover a lot of the above (see 'test' subdirectory)
  • [from this point on, things are no longer about pico8 compatibility, and so are even less likely to be wanted by you, including for completion's sake]
  • lua apis - fix in io module (io & os module are untested but much should be working)
  • tostr - support printing userdata
  • c api - fixed compilation of certain expressions (e.g. lua_Number lua_Integer ; lua_Number double) under various windows environments by adding generic operators. [needed for certain usages of the C api - not for z8lua itself]
  • c api - some changes and hacks to allow c<->lua code that uses luaL_ref/unref and lua_rawgeti/rawseti - to work with integers larger than 15K.

I'm happy to open a pull request if you let me know which changes you want me to include in it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions