Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
skindoc4
- VIP Livecode Opensource Backer

- Posts: 77
- Joined: Mon Jul 07, 2008 1:22 am
Post
by skindoc4 » Sun Nov 29, 2009 10:07 am
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.
Alex
-
ale870
- Posts: 250
- Joined: Tue Apr 22, 2008 9:17 am
-
Contact:
Post
by ale870 » Fri Dec 04, 2009 9:51 am
Hello,
I tried this code:
Code: Select all
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
-
skindoc4
- VIP Livecode Opensource Backer

- Posts: 77
- Joined: Mon Jul 07, 2008 1:22 am
Post
by skindoc4 » Sat Dec 05, 2009 3:56 am
Hi ale870
Thanks. I don't routinely declare my variables so I wonder if doing so makes RunRev more secure.
Just relocating a line of code to get it to work seemed very odd.
alex
-
ale870
- Posts: 250
- Joined: Tue Apr 22, 2008 9:17 am
-
Contact:
Post
by ale870 » Sat Dec 05, 2009 3:37 pm
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
-
skindoc4
- VIP Livecode Opensource Backer

- Posts: 77
- Joined: Mon Jul 07, 2008 1:22 am
Post
by skindoc4 » Sat Dec 05, 2009 10:50 pm
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.
alex
-
massung
- Posts: 93
- Joined: Thu Mar 19, 2009 5:34 pm
Post
by massung » Sun Dec 06, 2009 6:19 pm
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).
Jeff M.
-
ale870
- Posts: 250
- Joined: Tue Apr 22, 2008 9:17 am
-
Contact:
Post
by ale870 » Sun Dec 06, 2009 6:35 pm
It already in RunRev. Go in main menu Go to EDIT->PREFERENCES->SCRIPT EDITOR
Check "Strict compilation mode".

Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki