-
-
Notifications
You must be signed in to change notification settings - Fork 506
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
Janet Support #2069
Janet Support #2069
Conversation
Enough to do `new janet`
assert(tic != NULL); | ||
|
||
JANET_FN_S_tic(btn) | ||
janet_fixarity(argc, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear this param is optional, not required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's not in the doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would agree it's unclear.
btn([id]) -> pressed
The []
means the argument is optional. If no specific button is passed I believe the entire state of the button register (bitfield) is returned. (you can read the source to confirm)
I'm speaking largely of Lua, it might be useful to check and see if this has been handled correctly across all runtimes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, btn
and btnp
have the same-ish behavior for 0 arguments:
https://github.com/nesbox/TIC-80/blob/main/src/api/lua.c#L601
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btn()
seem to always return true
for me in the Lua version.
Co-authored-by: Josh Goebel <me@joshgoebel.com>
@locriacyber cool to see this MR, I actually spent some time on this same thing a while ago (branch here for comparison https://github.com/AlecTroemel/TIC-80/tree/charlotte_janet_support). I'd love to help get this MR ready however possible! some questions
|
Thanks for telling me. Seems like your work is further ahead.
|
No description provided.