ios - 在 Wax 中访问 Objective-C 实例

标签 ios lua iphone-wax

有一些用例我想创建某些对象的实例 在 objc 中并在 Lua/Wax 中访问它们。 我阅读了整个文档,但我仍然不确定如何 完成这个。

一些演示代码(不起作用,但你应该明白了)

galaxy = UIApplication:sharedApplication():delegate():galaxy() 
starclusters = galaxy:starclusters() 
galaxy_drawing = 
UIApplication:sharedApplication():delegate():galaxyDrawing() 
function set_starcluster_position_in_galaxy (x) 
starclusters:objectAtIndex(0):setValue_forKey("position_in_galaxy_x", 
300) 
    puts("Setting Starcluster Position X") 
end 

Disclaimer: I'm seeding some Google Groups iPhone Wax Questions on Stackoverflow

最佳答案

Wax 开发者 Corey 写道

If galaxy:starclusters() returns an NSArray, wax will automatically change this to a Lua array. This might be the problem

If you want to directly change the value of an NSArray or NSDictionary from Lua, and have the changes reflected in Objective-C that won't work right now, because Lua doesn't get the actual reference to the NSArray or NSDictionary back. Corey

来源:http://groups.google.com/group/iphonewax/browse_thread/thread/3042002cddfadc9c

关于ios - 在 Wax 中访问 Objective-C 实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6368893/

相关文章:

lua - Lua中的Wireshark解剖器

parameters - Lua:使用pcall

iphone - 尝试在 Wax 中创建诚实的 NSDecimalNumber

objective-c - 尝试在 iPhone-Wax 中创建 NSDecimal

ios - 如何在 UIAlertController 中为 UITextField 添加边距?

ios - 录音时播放音乐,无需重新路由

ios - 如何获取多点触控UITapGestureRecognizer的多个位置

python - Lupa可以用来在python中运行不受信任的lua代码吗?

ios - [__NSPlaceholderArray initWithObjects :count:]: attempt to insert nil object from objects[0]