What do these things do
8 posts • Page 1 of 1
What do these things do
I hope someone with more knowledge of Thyme can help me with this. I was digging into someone's code and I came across this weird thing which I don't know what it is. I thought they were local vars but they must not be because they dont have the _ in front of them.
Here's a picture for better understanding
Here's a picture for better understanding
(/)(°,,,°)(/)
-
pnvv - Posts: 670
- Joined: Tue Aug 26, 2014 11:46 pm
- Location: Disunited States of America
Re: What do these things do
pnvv wrote:I hope someone with more knowledge of Thyme can help me with this. I was digging into someone's code and I came across this weird thing which I don't know what it is. I thought they were local vars but they must not be because they dont have the _ in front of them.
Here's a picture for better understanding
Maybe those are variables, some guys did that..
waiting for semester break to come...
-
faytree - Posts: 947
- Joined: Mon Nov 05, 2012 1:37 pm
- Location: Selangor, Malaysia
Re: What do these things do
They'll be local vars, Basically, only variables starting with _ are serialised upon saving, here we have := which sorta also forces the variable to be created if it doesn't exist, hence removing the need to serialise them into the scene file;
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
Re: What do these things do
electronicboy wrote:They'll be local vars, Basically, only variables starting with _ are serialised upon saving, here we have := which sorta also forces the variable to be created if it doesn't exist, hence removing the need to serialise them into the scene file;
Ah, ok. I get it now, thanks guys.
(/)(°,,,°)(/)
-
pnvv - Posts: 670
- Joined: Tue Aug 26, 2014 11:46 pm
- Location: Disunited States of America
Re: What do these things do
Global variables are usually prefixed with _ to make them permanent. Local var's are created by writing any word or name in front of an '=', they will then be usable until scope they've been created in expires.
- FRA32
- Posts: 229
- Joined: Wed Dec 03, 2014 9:51 pm
Re: What do these things do
FRA32 wrote:Global variables are usually prefixed with _ to make them permanent. Local var's are created by writing any word or name in front of an '=', they will then be usable until scope they've been created in expires.
Don't confuse people! _ is just serialized and saved with scene variables, it's not related with scope. Local variables creates inside { } with := and they not visible outside. Also you could create variabls in object's scope, for example inside box object event e.this.a := 1 (will be removed after reload) or e.this._a := 1 (will be saved with scene).
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: What do these things do
Yeah, like I said, _ makes it permanent(saved by scene), while without _ it is local and this way only temporary, and also not accessible everywhere. Of course I don't want to confuse people but I am coding java in my freetime, so excuse if I use the incorrect words
- FRA32
- Posts: 229
- Joined: Wed Dec 03, 2014 9:51 pm
Re: What do these things do
FRA32 wrote:Yeah, like I said, _ makes it permanent(saved by scene), while without _ it is local and this way only temporary, and also not accessible everywhere. Of course I don't want to confuse people but I am coding java in my freetime, so excuse if I use the incorrect words
You still misunderstand or incorrectly describe. Variables with _ is local too. There is no difference between code {a:=1; b:=1, a+b} and {_a:=1; _b:=1, _a+_b}. The only difference is _variable in object will be serialized and saved.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
8 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 19 guests