It looks like you're new here. If you want to get involved, click one of these buttons!
static void dispatchEvent
if (products) { lua_newtable(L); for(int i = 0; i < [products count]; ++i) { SKProduct* product = [products objectAtIndex:i]; lua_newtable(L); lua_pushstring(L, [product.localizedTitle UTF8String]); lua_setfield(L, -2, "title"); lua_pushstring(L, [product.localizedDescription UTF8String]); lua_setfield(L, -2, "description"); lua_pushnumber(L, [product.price doubleValue]); lua_setfield(L, -2, "price"); lua_pushstring(L, [product.productIdentifier UTF8String]); lua_setfield(L, -2, "productIdentifier"); lua_rawseti(L, -2, i + 1); } lua_setfield(L, -2, "products"); }
if (products) { lua_newtable(L); for(int i = 0; i < [products count]; ++i) { SKProduct* product = [products objectAtIndex:i]; lua_newtable(L); lua_pushstring(L, [product.localizedTitle UTF8String]); lua_setfield(L, -2, "title"); lua_pushstring(L, [product.localizedDescription UTF8String]); lua_setfield(L, -2, "description"); NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; [numberFormatter setLocale:product.priceLocale]; NSString *formattedString = [numberFormatter stringFromNumber:product.price]; lua_pushstring(L, formattedString); lua_setfield(L, -2, "price"); lua_pushstring(L, [product.productIdentifier UTF8String]); lua_setfield(L, -2, "productIdentifier"); lua_rawseti(L, -2, i + 1); } lua_setfield(L, -2, "products"); }
lua_pushstring(L, [formattedString UTF8String]);
IAB:requestProducts()
[products] table [products] [1] table [products] [1] [price] string £0.69 [products] [1] [description] string Product 1 [products] [1] [title] string Pay to Win [products] [1] [productId] string p1
Comments
All it does, is, it returns the locale of the price.
But what you could do, is to get a formatted string from the price, like this:
inside storekit.mm
in this function
After modification, "price" value now will be like "0.99$" ?
And do you have chance to test the code?
Thanks for quick reply.
On line:
lua_pushstring(L, formattedString);
I get the error:
No matching function for call to 'lua_pushstring'
Thanks.
Niclas