iPhone Wax accessing already instantiated classes

100 views
Skip to first unread message

Hessi

unread,
Jun 15, 2011, 2:42:01 PM6/15/11
to iPhone Wax
There are some use cases I want to create instance of certain objects
in objc and access them in Lua/Wax.

I read the entire documentation but I'm still uncertain how to
accomplish this:

Some Demo Code (doesn't work, but you should get the idea)

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

corey

unread,
Jun 15, 2011, 3:18:11 PM6/15/11
to ipho...@googlegroups.com
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

Hessi

unread,
Jun 16, 2011, 4:14:09 AM6/16/11
to iPhone Wax
Hi Corey,
thanks for your quick reply.

I copied the question to stackoverflow
http://stackoverflow.com/questions/6368893/accessing-objective-c-instance-in-wax
(hope the disclaimer is okay)

http://stackoverflow.com/questions/tagged/iphone-wax



On Jun 15, 8:18 pm, corey <probablyco...@gmail.com> wrote:
> 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.
>
Reply all
Reply to author
Forward
0 new messages