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

Remove defaults for sx/sy in WASM map() function #2132

Merged
merged 1 commit into from Feb 17, 2023

Conversation

Madadog
Copy link
Contributor

@Madadog Madadog commented Feb 17, 2023

Solves #2131.

This enables calling map() from the WASM API with sx or sy=-1, which is consistent with the Lua API.

This does not break any of the current languages with templates (C, D, Rust, Zig) because arguments to map() cannot be omitted. However, for future languages which allow optional arguments, this may require workarounds at the language API level to get sx/sy=0 by default, if m3ApiGetArg() defaults to -1 on missing arguments (I do not understand how m3ApiGetArg() works, but the other defaults in wasm.c seem to assume a int32_t with a value of -1 from m3ApiGetArg() means a missing argument).

Copy link
Owner

@nesbox nesbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge this PR but I think we have to find a better solution to detect default variables in wasm.
Because I see the same problem for x = -1 or y = -1 for example.
@joshgoebel what do you think?

@nesbox nesbox added this to To do in dev version 1.1 via automation Feb 17, 2023
@nesbox nesbox merged commit eb59272 into nesbox:main Feb 17, 2023
dev version 1.1 automation moved this from To do to Done Feb 17, 2023
@nesbox nesbox linked an issue Feb 17, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

WASM map() function can't be called with sx or sy = -1
2 participants