I have just spent about an hour trying to sort out a problem moving data from an array to a variable. The line of code was:
put aPacket["vForward"] into theForward
I could clearly see that aPacket["vForward"] contained the data that it should have but the line of code failed completely - it simply would not put the data into the container. I tried different data without success until I simply cut it and pasted to another location - exchanged its location for the line after it. Amazingly it sprung to life.
Has anyone else observed such odd behaviour and is there an explanation. I am using sockets and have noticed some odd things whilst debugging and I wonder whether this had anything to do with it. I feel like I have had a paranormal experience.
local a
local myDest
put 100 into a["one"]
put 200 into a["two"]
put 300 into a["three"]
put a["two"] into myDest
answer myDest
This works for me. Try to use that small code to insert other data to check if there is particular data that don't like to RunRev.
I hope this help you.
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki
Variables declaration is a good method to avoid wrong syntax. Example:
put "ONE" into mynewvariablecontainingthename
answer mynewvariablecntainingthename
As you can see in this case, if variable checing is not performed, you don't get any error, but the code does NOT work (variables are different).
If you enable variable checking then the compiler RunRev will advice you that the second variable does not exist.
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki
Yes you are right about variable checking but that was not the problem on this occasion. Another development system, REALBasic, has a very powerful autocomplete feature and its requirement for declaring all variables almost completely elminates this problem. On the other hand, being able to declare variables on the fly does allow for writing code rapidly.
Most languages which allow for on-the-fly creation of variables also allow for a "strict" mode, or will at least toss up warnings that maybe you are doing something you didn't mean to do. It'd be nice if this was a Rev preference (if it isn't already there).