Skip to content

Checking for minimum/maximum number of native closure parameters#288

Open
provigz wants to merge 2 commits intoalbertodemichelis:masterfrom
provigz:params-check-range
Open

Checking for minimum/maximum number of native closure parameters#288
provigz wants to merge 2 commits intoalbertodemichelis:masterfrom
provigz:params-check-range

Conversation

@provigz
Copy link

@provigz provigz commented Jul 17, 2024

The sq_setparamscheck function, instead of accepting just the SQInteger nparamscheck parameter, now accepts both SQInteger nparamscheckmin and SQInteger nparamscheckmax.

Those define the minimum/maximum for the parameters number check policy. Setting any of them to 0 or negative disables the respective check.

I believe this change makes the parameter check way less restrictive and suitable for more use-cases. For example, it enables support for default arguments.


NOTE: This change makes changes to the API functions sq_setparamscheck and sq_getclosureinfo. I am not sure how Squirrel handles such changes (deprecation mechanic?). Because of this, I understand that this change might not be suitable for upstream.

provigz added 2 commits July 17, 2024 11:46
The `sq_setparamscheck` function, instead of accepting just one `SQInteger nparamscheck` parameter, now accepts `SQInteger nparamscheckmin` and `SQInteger nparamscheckmax`.

Those define the minimum/maximum for the parameters number check policy. Setting any of them to 0 or negative disables the respective check.

This enables support for optional parameters.
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

Successfully merging this pull request may close these issues.

1 participant