fake-08 icon indicating copy to clipboard operation
fake-08 copied to clipboard

Indexing into strings returns NIL

Open flexiondotorg opened this issue 1 year ago • 1 comments

While adapting my game to work with fake-08 text control codes, I also discovered fake-08 returns NIL when indexing into a string. I worked around the issue using sub(), but since PICO-08 0.2.5, using string indexes is preferred. Here's my patch:

https://github.com/wimpysworld/antsy-alien-attack-pico/commit/2aeed80b41819b1454284b2ee8eb8cd870aa4cfe

Here is a sample .p8 to reproduce the bug:

function _init()
 test="this is a test" 
end

function _draw()
 cls(0)
 print(test)
 print(sub(test,1,1))
 print(test[1])
end

flexiondotorg avatar May 28 '23 10:05 flexiondotorg

I haven't merged this into master yet, but I think I have this working and in the mean time you're welcome to check it out in the branch: https://github.com/jtothebell/fake-08/tree/string-indexing

There are also binaries built off of that branch in the actions: https://github.com/jtothebell/fake-08/actions/runs/4716430813

jtothebell avatar May 30 '23 00:05 jtothebell