Array question

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Array question

Post by marksmithhfx » Thu Aug 23, 2012 8:10 pm

if I want to use a variable instead of a literal for "object_label" in the following:

put parameter_value into myArray[1]["object_label"] // store the new value

what is the correct syntax? I've tried:

put quote & parameter_name & quote into tString
put parameter_value into myArray[1][tString] // store the new value

but that didn't work.

-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Array question

Post by mwieder » Thu Aug 23, 2012 8:19 pm

The syntax is correct, but don't put quotes around the parameter_name unless you really want quotes around it.

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Array question

Post by marksmithhfx » Thu Aug 23, 2012 9:31 pm

mwieder wrote:The syntax is correct, but don't put quotes around the parameter_name unless you really want quotes around it.
Thanks Mark, removing the quotes fixed the problem.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

Post Reply