fake-08
fake-08 copied to clipboard
Indexing into strings returns NIL
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
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