local tCurrentValue
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 16
- Joined: Thu Dec 08, 2011 12:20 pm
local tCurrentValue
I tried removing the line in the percentPressed command script “local tCurrentValue” and the program executed just fine. My question is, was this line added as part of “good programming practice” or is there some practical reason for adding this code. For a newbie all I see is one additional line of code which I can do away with, making the code more efficient...or is it? When would you recommend adding the local variable and when would you not have to. Why would it make sense to add this to this particular script and this particular app now that I don't see any difference in the result.
-
- VIP Livecode Opensource Backer
- Posts: 7255
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: local tCurrentValue
It's required if you are running with explicit variables turned on, which helps catch some typos in scripts. In some circles it's considered good programming practice as well, especially by those coming from other languages where it's required. I never debug with explicit variables so I don't include the declarations. It's mostly a matter of personal preference though it has been known to cause religious wars occasionally.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9847
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: local tCurrentValue
The only difference would be if the declaration is outside of a handler or inside. Outside is needed if you want the variable to be available to all handlers within the script. Inside is not necessary, used by some scripters for clarity.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 1
- Joined: Tue Mar 26, 2019 9:10 pm
- Contact:
Re: local tCurrentValue
If you will ever try to run it with explicit variables it work work , it fails big time !!!
Re: local tCurrentValue
This thread was necromanced by a spammer, three posts above this one.
-
- VIP Livecode Opensource Backer
- Posts: 9847
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: local tCurrentValue
Necromanced, yes. (And thank you for noting that. When I bring it up people just yell at me.)
But "spammer"? What is being spammed? No links in his sig, no links in the post, the post appears on-topic, and it contains apparently-unique content.
Admittedly, sometimes spammers are smarter than me. What am I missing?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: local tCurrentValue
Gone now, but he had come back and edited, with a link to one of those compressed urls. It definitely showed as a link (maybe two, maybe broken) on my phone, and when I was replying in this thread, the previous message list showed some mangled code for that.
Re: local tCurrentValue
I deleted the user yesterday and yes, he had two working links in his posting.
Obviously it is too hard to prevent this from users with postings < 10.
I asked Heather a couple of times and she tried what she could, but with very few success obviously.
Obviously it is too hard to prevent this from users with postings < 10.
I asked Heather a couple of times and she tried what she could, but with very few success obviously.
Re: local tCurrentValue
I don't think I ever yelled at you, but I do play a lot of D2, so Necros are good things imwv(in my world view)FourthWorld wrote: ↑Wed Mar 27, 2019 2:14 amNecromanced, yes. (And thank you for noting that. When I bring it up people just yell at me.)
But "spammer"? What is being spammed? No links in his sig, no links in the post, the post appears on-topic, and it contains apparently-unique content.
Admittedly, sometimes spammers are smarter than me. What am I missing?
Spammers and bots are a fun discussion. Some are obvious, some not so much. smithclarkson up there might fall under 'bot' status.
If your writing a bot for spamming forums, you generally want the bot 'accepted' for the first several posts as real, usually in testing. That is why you often see the 'catch phrases' clipping, where they skim the boards, pick up already posted lines from other real authors, and then try to put it into what 'looks' like a legitimate post.
Done well, it is a neat trick, one I wish I knew enough to figure out myself.
The 'brute force' ones are much easier to spot of course, they just get the account and blast as many posts as they can.
You can emulate this yourself in a few minutes, there is even a lesson on a similar topic about combining text strings. Instead of an insult generator, you put in tech / programming terms, and you get what was in the post SparkOut mentioned.No links in his sig, no links in the post, the post appears on-topic, and it contains apparently-unique content.