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

Function return values don't seem to work #32

Open
erinmaus opened this issue Jul 30, 2024 · 1 comment
Open

Function return values don't seem to work #32

erinmaus opened this issue Jul 30, 2024 · 1 comment
Labels
bug Something isn't working parser

Comments

@erinmaus
Copy link

Hi! Love this library! Integrating it into my game for in-game books & dialog!

As the title says, function return values don't seem to work. Take this example from the Ink docs:

Monsieur Fogg was looking {describe_health(45)}.

=== function describe_health(x) ===
{
- x == 100:
	~ return "spritely"
- x > 75:
	~ return "chipper"
- x > 45:
	~ return "somewhat flagging"
- else:
	~ return "despondent"
}

When run inside narrator, ~ return "despondent" (and others) compile to incorrect Lua code. It would generator an error along the lines of: narrator/libs/lume.lua:674: [string "return nil "despondent""]:1: '<eof>' expected near '"despondent"'.

It's not a showstopper for me, I prefer writing any functions in Lua and binding them, I'd prefer to keep the ink as free from any sort of code as possible. But it would be a nice to have. :) I didn't see this in the "known issues" tags, so I'm sorry if this already known! And hopefully it's not too niche.

@astrochili astrochili added bug Something isn't working parser labels Jul 30, 2024
@astrochili
Copy link
Owner

Thanks for the report, looks like a bug. Using bindings in this case will be the right decision, as local functions may not be as well tested in production I guess (at least I personally haven't used them yet).

I don't have high hopes that @abadonna will join in solving this problem since he's already created his own library, but if he suddenly gets bored and has nothing to do then I will welcome any ideas and suggestions 🙋‍♂️.

Otherwise, of course, I'll see what's going wrong here over some afternoon tea 🫖🌙.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser
Projects
None yet
Development

No branches or pull requests

2 participants