Thread: [Solved] Natives and Methodmaps
View Single Post
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 06-07-2018 , 09:15   Re: Natives and Methodmaps
Reply With Quote #9

You return exactly what you would usually return, except as an integer. If necessary, do a view_as<int> on it to get rid of the tag mismatch warning. You have to return an int for all native implementations. If the actual native has a different return type that will be handled by SM and it'll "cast" it from an int to the correct type.

For example if you have a native like this:
PHP Code:
native float GetSomeFloat(); 
the implementation would look like this:
PHP Code:
public int Native_GetSomeFloatHandle pluginint numParams )
{
    return 
view_as<int>( 5.0 ); // do the view_as to get rid of the tag mismatch warning

hmmmmm is offline