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

NativeMethod - add ability to pass params object[] (as in {Float:,_}:...) #260

Closed
ghost opened this issue Jun 6, 2018 · 2 comments
Closed
Labels
area-Natives Issues related to invoking natives through SampSharp.Core feature
Milestone

Comments

@ghost
Copy link

ghost commented Jun 6, 2018

No description provided.

@ikkentim ikkentim modified the milestones: 0.8.0, 0.9.0 Jun 6, 2018
@ikkentim ikkentim added the area-Natives Issues related to invoking natives through SampSharp.Core label Jul 5, 2018
@ikkentim ikkentim modified the milestones: 0.10.0, 0.11.0 Dec 7, 2020
@ikkentim ikkentim modified the milestones: 0.11.0, 0.10.0 Mar 9, 2022
@ikkentim
Copy link
Owner

ikkentim commented Mar 9, 2022

Added simple varargs support.

  • NOTE: The variable arguments array must be of type object[] and must be decorated with the params attribute.
  • NOTE: Currently, only varargs of type int, bool and float are supported. If someone needs support for other types, they should raise an issue.
  • NOTE: I've only added support in the "fast natives" variant of native objects. This means this will ONLY work in hosted mode, not in muli-process mode. I didn't want to put time into implementing this feature in multi-process mode because this mode is deprecated.
    Example:
    public class SomeClassWithNatives
    {
        [NativeMethod]
        public virtual void VarArgsTestMethod(int x, int y, int z, params object[] args)
        {
            throw new NativeNotImplementedException();
        }
    }

@ikkentim
Copy link
Owner

Strings and arrays are now also supported in varargs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Natives Issues related to invoking natives through SampSharp.Core feature
Projects
None yet
Development

No branches or pull requests

1 participant