Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 试图在蜡像中创建小数点_Iphone_Cocoa Touch_Cocoa_Iphone Wax - Fatal编程技术网

Iphone 试图在蜡像中创建小数点

Iphone 试图在蜡像中创建小数点,iphone,cocoa-touch,cocoa,iphone-wax,Iphone,Cocoa Touch,Cocoa,Iphone Wax,当我在研究我所面临的问题时,我现在的目标要低得多。如何在Wax中创建功能齐全的NSDecimalNumber 我在一个新的蜡项目中的AppDelegate.lua顶部添加了以下两行 local x = NSDecimalNumber:initWithString("2.3") print(x) print(x:class()) 输出是 (0x631e054 => 0x631d1a0) 2.3 (0x631e924 => 0x25f618) NSCFNumber 而不是像 (0x6

当我在研究我所面临的问题时,我现在的目标要低得多。如何在Wax中创建功能齐全的NSDecimalNumber

我在一个新的蜡项目中的AppDelegate.lua顶部添加了以下两行

local x = NSDecimalNumber:initWithString("2.3")
print(x)
print(x:class())
输出是

(0x631e054 => 0x631d1a0) 2.3
(0x631e924 => 0x25f618) NSCFNumber
而不是像

(0x621e834 => 0x620c550) <NSDecimalNumber: 0x620c550>
日志中显示了两件我没有要求的东西,NSDecimalNumberPlaceholder和NSCFNumber。我相信这些是我悲伤的根源,我不知道它们来自哪里。关于如何解决这个问题有什么想法吗


最终我想调用方法decimalValue,但wax抱怨它无法调用数字上的方法。

NSDecimalNumber覆盖
-description
,返回它所表示的数字。当您记录语句打印“2.3”时,它实际上是在打印NSDecimalNumber对象。您可以通过对
x
值调用
-class
并打印该值来验证这一点。

我想对对象执行的操作是调用decimalValue方法。它抱怨数字2.3没有这个方法,所以我不相信它在伪造它显示的内容。听起来你得到的是一个NSNumber而不是NSDecimalNumber。我想知道Wax是否在做一些奇怪的事情?NSNumber也应该接受小数,所以这不是NSNumber。我试过class方法,它说是和NSCFNumber。@John Smith:啊,hrm
-decimalValue
返回一个结构。Wax甚至支持structs吗?@Kevin Ballard:如果你将它们包括在structs中,那么是的。lua如果它是一个不诚实的
NSDecimalNumber
?;)会有区别吗@戴夫·德隆:只要能转换成十进制。
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)
:
: