Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to create honest NSDecimalNumber in Wax
    primarykey
    data
    text
    <p>As I studied the issue I am facing in <a href="https://stackoverflow.com/questions/6406123/trying-to-create-nsdecimal-in-iphone-wax">Trying to create NSDecimal in iPhone-Wax</a> I am now aiming much lower. How can I create a fully functional NSDecimalNumber in Wax?</p> <p>I have added the following two lines at the top of AppDelegate.lua in a fresh wax project.</p> <pre><code>local x = NSDecimalNumber:initWithString("2.3") print(x) print(x:class()) </code></pre> <p>The output is </p> <pre><code>(0x631e054 =&gt; 0x631d1a0) 2.3 (0x631e924 =&gt; 0x25f618) NSCFNumber </code></pre> <p>instead of something like</p> <pre><code>(0x621e834 =&gt; 0x620c550) &lt;NSDecimalNumber: 0x620c550&gt; </code></pre> <p>Turning on full logging in wax give the following trace in the debug window:</p> <pre><code>Creating class for WaxServer(0x621bf40) Storing reference of class to userdata table WaxServer(0x621bf40 -&gt; 0x621c454) Storing reference to strong userdata table WaxServer(0x621bf40 -&gt; 0x621c454) Creating class for NSDecimalNumber(0x261120) Storing reference of class to userdata table NSDecimalNumber(0x261120 -&gt; 0x6205e44) Storing reference to strong userdata table NSDecimalNumber(0x261120 -&gt; 0x6205e44) Creating instance for NSDecimalNumberPlaceholder(0x6213450) Retaining instance for NSDecimalNumberPlaceholder(0x6213450 -&gt; 0x621d7c4) Storing reference of instance to userdata table NSDecimalNumberPlaceholder(0x6213450 -&gt; 0x621d7c4) Storing reference to strong userdata table NSDecimalNumberPlaceholder(0x6213450 -&gt; 0x621d7c4) Creating instance for NSCFNumber(0x620c550) Retaining instance for NSCFNumber(0x620c550 -&gt; 0x621e834) Storing reference of instance to userdata table NSCFNumber(0x620c550 -&gt; 0x621e834) Storing reference to strong userdata table NSCFNumber(0x620c550 -&gt; 0x621e834) (0x621e834 =&gt; 0x620c550) 2.3 Creating class for AppDelegate(0x621ec50) : : </code></pre> <p>Two things are showing in this log which I did not ask for, NSDecimalNumberPlaceholder and NSCFNumber. I believe these are the source of my grief and I have no idea where they are coming from. Any ideas on how to fix the issue?</p> <p>Ultimately I want to call the method decimalValue, but wax complains that it can't call a method on a number.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload