Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexing into strings returns NIL #198

Open
flexiondotorg opened this issue May 28, 2023 · 1 comment
Open

Indexing into strings returns NIL #198

flexiondotorg opened this issue May 28, 2023 · 1 comment

Comments

@flexiondotorg
Copy link

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:

wimpysworld/antsy-alien-attack-pico@2aeed80

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
@jtothebell
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants