PromptPurchase Unnecessary parameter

Not sure if this is the right place but…

Since Robux are the only currency on roblox now we no longer need the CurrencyType Parameter.

Also please do fix the wiki page for it: Documentation - Roblox Creator Hub

and: Documentation - Roblox Creator Hub

1 Like

Luckily enough it’s the last parameter in every function that uses it, so we never have to touch CurrencyType and it may be easier to deprecate it that way.

The parameter will most likely need to be left there to avoid breaking legacy games that still use it. The client code will have to be modified to ignore that parameter.

2 Likes

This might be a nice moment to add the whole “custom price” thing.
(although I’m not sure if that’s good for regular assets… discount stuff?)
If that parameter is a number, use it as custom price.
If it’s the CurrencyType parameter, just ignore it.

(idk, just want the whole custom price thing. seems like a good moment now)

2 Likes

What about those that use the Enum IDs? They will end up trying to charge 0-2 robux for their product with your implementation.

I totally didn’t think about that…

Huh? I did say deprecate not delete. :stuck_out_tongue: It’s just more convenient to deprecate a parameter at the end of a function rather than one in the beginning/middle, I would say.

Should also remove PriceInTickets from MarketplaceService:GetProductInfo() while we’re at it.

They can technically remove it now without problems, since its the last parameter in both methods.

One of the interesting things I discovered about how Roblox handles methods, is that they don’t care how many arguments are inputted into the function, as long as the pre-requisites are in place.

For example:

game:WaitForChild("Workspace",0,1,2,3,4,5,6)

This code does not error, despite the fact that I plugged several useless parameters into it. Those extra parameters are simply disregarded.

Thus, if they removed the currencyType parameter, any function still trying to use it would just discard it without issues.

In the long run, this probably isn’t desirable, so you’d be better off just removing it from your code now, but they don’t need to warn anyone about its removal.

Say thanks to Lua for that. The argument is still provided, and Lua just cleans up after.

For example, you can create a C function which only uses one argument:

int test_function(lua_State *L)
{
    int numargs = lua_gettop(L);
    printf("Got %d arg(s)\n", numargs);
    
    const char* message = luaL_checkstring(L, 1);
    printf("Message was: %s\n", message);
    
    return 0;
}

EDIT: whoops, im a noob.

You can call it however you want:

test_function("testing", unpack({}, 1, 100)) -- 101 arg(s)
test_function("only one!") -- 1 arg(s)

EDIT 2: see EinsteinK’s response

That are… only… 3 arguments…
you didn’t actually run it, did you?

Oh well, not sure why it reaaallly matters.

1 Like

Oh yeah, derp. I forgot that Lua only uses the first item in the varargs when passing like that :stuck_out_tongue: