I really, really hope you read this, Turan. I can't wait to see whether my metaphors involving sacks and potatoes will make you laugh or weep openly; or weep disgusted tears of joy whilst laughing.
*Rowne holds up a sack, "This is your self, the center of being," he then holds up a potato, "this is your potato, your tool of self," and with that, the potato is rapidly shook, taking the form of a bag, "but sometimes, the potato ... is your sack." *Classroom, in chorus, "Ohhhhhhh!"
Just read Class #1. Excellent work, Rowne. Very interesting discussion. I must say I was very amused.
***Rowne will have to tell Turan about the self.Get potato later.
...
In Soviet Russia, the bag is put into the potato!
*lmao*
I love the potato metaphor, Rowne. Just love it. I'll be using it every chance I get.
If anyone has lingering questions, please post. I noticed a couple things I wanted to add some comments on. Note that if I only add confusion, then ignore this. It's not too important, just for your information if you want it.
TRUE/FALSE
I just wanted to point out that these are merely Ace global variables (they are not part of Lua inherently) that are set to 1 (TRUE) and nil (FALSE). You could just as easily use 1 and nil in place of these. So why use TRUE/FALSE? Readability only. If you're browsing unfamiliar code, it's easier to recognize that someVar = TRUE is intended to be used as a boolean, whereas if you see someVar = 1 you don't know if that's intended for use as a boolean or an actual number. In other words, will someVar = 1 be used later in this capacity: if( someVar ) then ... else ... end; or in this capacity: newValue = someVar * 5. someVar = TRUE is an immediate cue.
Also, Lua does have real true/false (all lowercase) variables. The reason I find TRUE/FALSE preferable is because true gets written to SavedVariables files as "true" and false gets written as "false" (or possibly "nil" - I forget). Also, false keeps the variable in memory! That's important. If you define a variable with someVar = FALSE this does nothing. It's merely for readability so someone looking at your code knows you intend to use someVar as a variable later. (i.e., it's a potato I'll be tossing in the sack later. ;)) But the variable doesn't actually get created, so it doesn't add memory or SavedVariables bloat. If you instead use someVar = false, then this variable is created immediately, takes up memory, and bloats your SavedVariables. How big's your sack now?
Classes
I wanted to mention that there is a difference between classes and objects regarding how they are intended to be used. Mechanically, Lua sees no difference. But it's important to keep the terms, because there are "classes" that aren't intended to be used as objects. For example, the AceAddon class. This is intended to be used as a class to build your individual addons from, but not to be used as an object itself:
So for addons, the addon and class are one, because we (no longer) bother creating an addon "class" (e.g., AddOn1Class = AceAddon:new()) then an addon "object" later: AddOn1 = AddOn1Class:new().
In most languages you have to create a class as a separate entity to buiild your objects from. But Lua plays by different rules, and quite frankly, we can capitalize on these rules for improved efficiency.
and false gets written as "false" (or possibly "nil" - I forget).
Yup, false gets written as false, not nil. A lot of AddOns do this and they have both true and false variables everywhere. Everywhere in the saved variables, everywhere. The reason I told them to use TRUE/nil was that it wouldn't confuse matters. I know your FALSE global is nil but the way I explained it was that variables are Creation/Deletion rather than true/false and it just made more sense to show that as TRUE/nil. S'all.
So in effect, everyone. Turan's TRUE/FALSE are okay but true/false (lowercase) are bad, very bad. Still, you can save lines of code in your database by not setting FALSE variables in your defaults at all because it's not required. Just a heads-up, really.
If you define a variable with someVar = FALSE this does nothing.
I was talking of true/false though, not TRUE/FALSE ... sorry.
The thing is, 'false' does use memory because unlike your TRUE/FALSE, their false is a value, not nil but an actual value.
This is why I stressed the point so much because somewhere down the line someone might mix up higher/lower-case TRUE/FALSE, it's easier to now just teach TRUE/nil where that could never happen. That was my ethos and mindset.
No, I realized what you were saying. I was criticizing anything you said. I just wanted to clarify the differences and point out that TRUE/FALSE aren't inherent in Lua.
Still, you can save lines of code in your database by not setting FALSE variables in your defaults at all because it's not required
You mean extra lines of code in the database definition? It doesn't insert extra lines in the database itself, meaning nothing extra in the SavedVariables.
Yeah, I understand that. The reason I sometimes insert the FALSE values anyway is the same reason I sometimes insert comments. It just gives me a nice list of my settings to reference. If I had large databases, I probably wouldn't do it just because it'd take up an annoying amount of space.
This stuff is way over my head, but thanks for trying. I guess I'm missing some of the prereqs.
Seriously though, how do you programmers learn this stuff. I think it's innate ability or something. All my life anytime I've seen a programmming class, it's as if everyone in the class already knows what's going on.
Don't feel bad or anything, it's really not your fault, and you are doing a great job with instructions, but I was seriously lost from the first sentence.
I need programming preschool or something, I guess.
We discussed the need to create a programming basics kind of reference or tutorial. Hopefully one of us will get a chance to do that sometime. A lot of people who've never programmed and want to do addon coding struggle with the basics. It's hard to pick up if you've never done any programming before.
BELEIVE ME Jahmonzu, your not alone by any means. I am completely self taught up to these classes, staring at code until it made sense to me.
Literally. Staring at code. For HOURS. Staring, saying, "huh?", then eventually, "ahh". Now with Ace, it's a totally new mindset, and for me the biggest "hurdle" I have to overcome is forgetting eveything (as little as it is) I've learn so far in LUA and start to think differently for Ace.
It is a very slow and tetious process for me. But like some people learn to play the guitar faster than... wait, let me start over. But like some people learn how to chop a potato faster than others (i couldn't resist), it can be taught to anyone, given the time rquired to help them find their understanding of it.
West of the Burmuda Triangle, they're called FrenchFries, for that is what they are. Who dares argue with McDonald's?
Some weridos on another continent call them chips. Now, I'm not saying who...*COUGH*brittian*SNEEZE*france*HACK*germany*WHEEZE*... cuse me, had a coughing attack there.
"Rowne: If a variable isn't in the function parenthesis or doesn't have local behind it, it's global."
the control variables in for statements are also automatically localized. I still see addon authors declaring their control variables as local before using them. why?
a = "volkswagen"
for a = 1,4 do
print(a) -- will print numbers
end
print(a) -- will print "volkswagen"
I read all of class 1. my brain melted. Not because I don't get it - I already understand Lua and -most- of it's concepts. However, even knowing how this stuff works - the deep underlaying mechanics of tables - Rowne TOTALLY confused the shit out of me. I'm not surprised some people didn't grasp it. Some examples: Someone brought up the topic of anonymous functions (but didn't know what to call it). Rowne should have stopped the conversation right there to explain it because it's one of the critical underlaying principles that make objects work in lua. Also, the syntatic sugar of the colon operator could have been explained a little better. If I didn't understand it already, I'd still be completely confused about where "self" comes from - but more importantly, why.
I will make an attempt to attend these.
edit: rereading my own post, I sounded bitchy. I didn't mean to. Honestly, I just want to help.
Stylpe, Kayde and illitrate seem to grasp it just fine.
I suppose imagination and creative visualization is required for my classes and either you got it or you don't.
Oh and I did stop to explain everything. Thanks much. I stopped to explain everything that was asked of me. I just did it in order. I queued up things and responded to them all.
Just don't turn up in the class room to complain about my teaching methods, thanks. You can hold your own classes if you like but I'm doing my best. I really am. And they seem to appreciate it and they seem to get it. So I see no problems.
< Edit >
Just understand that I held these classes because no one else wanted to, everyone present thought I was doing a damned good job and I did too. I was just sharing as much as I could in the best way I know how; like a school classroom study section, lots of creative thinking to get around boring code problems. I thought I'd done a good job. I thought it was an entertaining way to teach and I honestly believe they enjoyed it.
I'll just continue to do my best, regardless of what anyone thinks.
< Edit >
As it is, the class fully understood what I was talking about. If these logs are going to inundate me with people turning up in the class saying; "That's not how you teach that, do it MY way!" then I'm just going to take the logs down because they're more trouble than they're worth.
< Edit >
Let me just say Trimble that I'm not angry at you for that. Shocked and surprised a bit that you'd just tear into the classes like that and rip me a new one over 'em. A little hurt that you didn't even bother to read them before accusing. ... and a little disappointed because I expected better of you.
The class was having fun and I was having fun. No one expressed any misunderstandings, if they did I'd step back and try to help them out. Why is it that a stick-in-the-mud always has to come along and try to ruin everyone elses fun just because they aren't having fun?
Yeah, definitely disappointed.
You may've been confused by it but don't make the assumption that the class thought I was a bad teacher. If you want to take teh class for a while, you can do so. I was just volunteering. We'll see how it turns out for you. Seriously though, that was bad karma and whacked out my good vibes.
< Edit >
I caught your edit but ... I know what it sounded like to me.
I'll accept what you've said but I'm still a bit disappointed.
[Class #1]
[Class #2]
[Class #3]
[Moderator]
The classes can now be found here
[Classes]
[/Moderator]
*Classroom, in chorus, "Ohhhhhhh!"
*lmao*
I love the potato metaphor, Rowne. Just love it. I'll be using it every chance I get.
If anyone has lingering questions, please post. I noticed a couple things I wanted to add some comments on. Note that if I only add confusion, then ignore this. It's not too important, just for your information if you want it.
TRUE/FALSE
I just wanted to point out that these are merely Ace global variables (they are not part of Lua inherently) that are set to 1 (TRUE) and nil (FALSE). You could just as easily use 1 and nil in place of these. So why use TRUE/FALSE? Readability only. If you're browsing unfamiliar code, it's easier to recognize that someVar = TRUE is intended to be used as a boolean, whereas if you see someVar = 1 you don't know if that's intended for use as a boolean or an actual number. In other words, will someVar = 1 be used later in this capacity: if( someVar ) then ... else ... end; or in this capacity: newValue = someVar * 5. someVar = TRUE is an immediate cue.
Also, Lua does have real true/false (all lowercase) variables. The reason I find TRUE/FALSE preferable is because true gets written to SavedVariables files as "true" and false gets written as "false" (or possibly "nil" - I forget). Also, false keeps the variable in memory! That's important. If you define a variable with someVar = FALSE this does nothing. It's merely for readability so someone looking at your code knows you intend to use someVar as a variable later. (i.e., it's a potato I'll be tossing in the sack later. ;)) But the variable doesn't actually get created, so it doesn't add memory or SavedVariables bloat. If you instead use someVar = false, then this variable is created immediately, takes up memory, and bloats your SavedVariables. How big's your sack now?
Classes
I wanted to mention that there is a difference between classes and objects regarding how they are intended to be used. Mechanically, Lua sees no difference. But it's important to keep the terms, because there are "classes" that aren't intended to be used as objects. For example, the AceAddon class. This is intended to be used as a class to build your individual addons from, but not to be used as an object itself:
So for addons, the addon and class are one, because we (no longer) bother creating an addon "class" (e.g., AddOn1Class = AceAddon:new()) then an addon "object" later: AddOn1 = AddOn1Class:new().
In most languages you have to create a class as a separate entity to buiild your objects from. But Lua plays by different rules, and quite frankly, we can capitalize on these rules for improved efficiency.
That's all for now. I'll read Class 2 later.
I knew that if anyone would appreciate that, you would.
Thankfully, the class did too!
[Potato!]
and false gets written as "false" (or possibly "nil" - I forget).
Yup, false gets written as false, not nil. A lot of AddOns do this and they have both true and false variables everywhere. Everywhere in the saved variables, everywhere. The reason I told them to use TRUE/nil was that it wouldn't confuse matters. I know your FALSE global is nil but the way I explained it was that variables are Creation/Deletion rather than true/false and it just made more sense to show that as TRUE/nil. S'all.
So in effect, everyone. Turan's TRUE/FALSE are okay but true/false (lowercase) are bad, very bad. Still, you can save lines of code in your database by not setting FALSE variables in your defaults at all because it's not required. Just a heads-up, really.
If you define a variable with someVar = FALSE this does nothing.
I was talking of true/false though, not TRUE/FALSE ... sorry.
The thing is, 'false' does use memory because unlike your TRUE/FALSE, their false is a value, not nil but an actual value.
This is why I stressed the point so much because somewhere down the line someone might mix up higher/lower-case TRUE/FALSE, it's easier to now just teach TRUE/nil where that could never happen. That was my ethos and mindset.
You mean extra lines of code in the database definition? It doesn't insert extra lines in the database itself, meaning nothing extra in the SavedVariables.
... is pointless and will result in a bigger filesize than;
Sure, the change is infinitesimal in size but for a perfectionist like me, every byte counts.
1. You didn't credit me for the Potato flash T_T
2. Yay, you spelt infinitesimal correctly :D
Seriously though, how do you programmers learn this stuff. I think it's innate ability or something. All my life anytime I've seen a programmming class, it's as if everyone in the class already knows what's going on.
Don't feel bad or anything, it's really not your fault, and you are doing a great job with instructions, but I was seriously lost from the first sentence.
I need programming preschool or something, I guess.
Literally. Staring at code. For HOURS. Staring, saying, "huh?", then eventually, "ahh". Now with Ace, it's a totally new mindset, and for me the biggest "hurdle" I have to overcome is forgetting eveything (as little as it is) I've learn so far in LUA and start to think differently for Ace.
It is a very slow and tetious process for me. But like some people learn to play the guitar faster than... wait, let me start over. But like some people learn how to chop a potato faster than others (i couldn't resist), it can be taught to anyone, given the time rquired to help them find their understanding of it.
Some weridos on another continent call them chips. Now, I'm not saying who...*COUGH*brittian*SNEEZE*france*HACK*germany*WHEEZE*... cuse me, had a coughing attack there.
Hey, there's you, in the logs, posting the URL!
brittian
CHIiiiiiIIIIIiiiiiIIIPS! ;p
the control variables in for statements are also automatically localized. I still see addon authors declaring their control variables as local before using them. why?
I read all of class 1. my brain melted. Not because I don't get it - I already understand Lua and -most- of it's concepts. However, even knowing how this stuff works - the deep underlaying mechanics of tables - Rowne TOTALLY confused the shit out of me. I'm not surprised some people didn't grasp it. Some examples: Someone brought up the topic of anonymous functions (but didn't know what to call it). Rowne should have stopped the conversation right there to explain it because it's one of the critical underlaying principles that make objects work in lua. Also, the syntatic sugar of the colon operator could have been explained a little better. If I didn't understand it already, I'd still be completely confused about where "self" comes from - but more importantly, why.
I will make an attempt to attend these.
edit: rereading my own post, I sounded bitchy. I didn't mean to. Honestly, I just want to help.
Stylpe, Kayde and illitrate seem to grasp it just fine.
I suppose imagination and creative visualization is required for my classes and either you got it or you don't.
Oh and I did stop to explain everything. Thanks much. I stopped to explain everything that was asked of me. I just did it in order. I queued up things and responded to them all.
Just don't turn up in the class room to complain about my teaching methods, thanks. You can hold your own classes if you like but I'm doing my best. I really am. And they seem to appreciate it and they seem to get it. So I see no problems.
< Edit >
Just understand that I held these classes because no one else wanted to, everyone present thought I was doing a damned good job and I did too. I was just sharing as much as I could in the best way I know how; like a school classroom study section, lots of creative thinking to get around boring code problems. I thought I'd done a good job. I thought it was an entertaining way to teach and I honestly believe they enjoyed it.
I'll just continue to do my best, regardless of what anyone thinks.
< Edit >
As it is, the class fully understood what I was talking about. If these logs are going to inundate me with people turning up in the class saying; "That's not how you teach that, do it MY way!" then I'm just going to take the logs down because they're more trouble than they're worth.
< Edit >
Let me just say Trimble that I'm not angry at you for that. Shocked and surprised a bit that you'd just tear into the classes like that and rip me a new one over 'em. A little hurt that you didn't even bother to read them before accusing. ... and a little disappointed because I expected better of you.
The class was having fun and I was having fun. No one expressed any misunderstandings, if they did I'd step back and try to help them out. Why is it that a stick-in-the-mud always has to come along and try to ruin everyone elses fun just because they aren't having fun?
Yeah, definitely disappointed.
You may've been confused by it but don't make the assumption that the class thought I was a bad teacher. If you want to take teh class for a while, you can do so. I was just volunteering. We'll see how it turns out for you. Seriously though, that was bad karma and whacked out my good vibes.
< Edit >
I caught your edit but ... I know what it sounded like to me.
I'll accept what you've said but I'm still a bit disappointed.
I mean ... yeah, nevermind. *Sigh.*
Everyone involved could say it was a resounding success.