Page 1 of 1

variable content is wrong [SOLVED, feature request?]

Posted: Fri Aug 14, 2015 8:34 pm
by mattmaier
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.

Re: variable content is wrong

Posted: Fri Aug 14, 2015 8:48 pm
by mattmaier
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

Re: variable content is wrong

Posted: Fri Aug 14, 2015 9:10 pm
by mattmaier
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?

Re: variable content is wrong

Posted: Fri Aug 14, 2015 9:54 pm
by FourthWorld
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