有一些用例我想创建某些对象的实例 在 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/