variable content is wrong [SOLVED, feature request?]

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

variable content is wrong [SOLVED, feature request?]

Post by mattmaier » Fri Aug 14, 2015 8:34 pm

So I've got a function where I passed in some parameters. I'm trying to put the contents of an array into a temp variable using three of the parameters to specify the array position. It seems like two of the three variables work, but one of them doesn't.

Code: Select all

function resourceRollup pDoc,pSeed,pDirection,pPayload -- pDoc is 1, pSeed is 6
   put the keys of sMainShort[pDoc] into tKeys -- this works
   put the keys of sMainShort[1] into tKeys2 -- this works
   put the keys of sMainShort[pDoc][pSeed] into tKeys3 -- this does not work; returns empty
   put the keys of sMainShort[pDoc][6] into tKeys4 -- this works
   if pSeed is 6 then put true into tTest -- returns true
   if pSeed is "6" then put true into tTest2 -- returns true
I assumed I did something wrong, but Livecode seems to think that whatever's in pSeed is 6, and there is a key in sMainShort[1] called 6, but when I try to use pSeed to address the array with 6 it doesn't work.
I tried closing and reopening Livecode on the off chance it was a weird one-off bug but it persisted.
Last edited by mattmaier on Fri Aug 14, 2015 9:10 pm, edited 1 time in total.

mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

Re: variable content is wrong

Post by mattmaier » Fri Aug 14, 2015 8:48 pm

This works too. I get the keys I'd expect.

Code: Select all

   repeat with tCount = 1 to 100 step 1
      put the keys of sMainShort[pDoc][tCount] into tTesting[tCount]
   end repeat

mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

Re: variable content is wrong

Post by mattmaier » Fri Aug 14, 2015 9:10 pm

Figured it out.

When I answered all three variables in one string I could see that pSeed had a trailing return. Apparently that didn't bother Livecode when I asked if pSeed was 6 or "6" but it did silently break when I tried to use pSeed to lookup an array.

This is not the first time I've spent more than an hour troubleshooting a problem that would have been trivial to solve if the variable watcher actually showed the contents of the variable instead of ignoring formatting characters like return. The tooltip that shows what's in a variable when the running script is paused did not show a second empty line and neither did the actual variable watcher under the script. Since the formatting characters are obviously important to how the variable performs, they should be visible.

Ah, yes, here it is. The exact same problem. http://forums.livecode.com/viewtopic.php?f=7&t=21595

Is there a place to submit feature requests?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: variable content is wrong

Post by FourthWorld » Fri Aug 14, 2015 9:54 pm

mattmaier wrote:Is there a place to submit feature requests?
Yep:
http://quality.runrev.com/

Also - got your email about Platyvue, will review and reply shortly. Everyone I've mentioned the project to sounds quite interested in it.

For the rest of you who may not have seen it, this GPL-governed project has a thread in the Community Projects section:
http://forums.livecode.com/viewtopic.php?f=108&t=23852
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply