When I studied the problem that I encountered in Trying to create NSDecimal in iPhone-Wax , now I am aiming much lower. How to create a fully functional NSDecimalNumber in Wax?
I added the following two lines at the top of AppDelegate.lua in the new wax project.
local x = NSDecimalNumber:initWithString("2.3") print(x) print(x:class())
Output signal
(0x631e054 => 0x631d1a0) 2.3 (0x631e924 => 0x25f618) NSCFNumber
instead of something like
(0x621e834 => 0x620c550) <NSDecimalNumber: 0x620c550>
Enabling full wax input will give the following trace in the debug window:
Creating class for WaxServer(0x621bf40) Storing reference of class to userdata table WaxServer(0x621bf40 -> 0x621c454) Storing reference to strong userdata table WaxServer(0x621bf40 -> 0x621c454) Creating class for NSDecimalNumber(0x261120) Storing reference of class to userdata table NSDecimalNumber(0x261120 -> 0x6205e44) Storing reference to strong userdata table NSDecimalNumber(0x261120 -> 0x6205e44) Creating instance for NSDecimalNumberPlaceholder(0x6213450) Retaining instance for NSDecimalNumberPlaceholder(0x6213450 -> 0x621d7c4) Storing reference of instance to userdata table NSDecimalNumberPlaceholder(0x6213450 -> 0x621d7c4) Storing reference to strong userdata table NSDecimalNumberPlaceholder(0x6213450 -> 0x621d7c4) Creating instance for NSCFNumber(0x620c550) Retaining instance for NSCFNumber(0x620c550 -> 0x621e834) Storing reference of instance to userdata table NSCFNumber(0x620c550 -> 0x621e834) Storing reference to strong userdata table NSCFNumber(0x620c550 -> 0x621e834) (0x621e834 => 0x620c550) 2.3 Creating class for AppDelegate(0x621ec50) : :
In this log, which I did not request, two things are displayed: NSDecimalNumberPlaceholder and NSCFNumber. I believe that this is the source of my grief, and I have no idea where they came from. Any ideas for fixing the problem?
Ultimately, I want to call the decimalValue method, but the wax fixes that it cannot call the method for the number.
source share