xmoonproductions.org https://xmoonproductions.org/ |
|
Languages, Softwares and code https://xmoonproductions.org/viewtopic.php?f=27&t=3342 |
Page 2 of 2 |
Author: | BubbaGump [ Sun Oct 12, 2014 6:41 am ] |
Post subject: | Re: Languages, Softwares and code |
Ah okay, that makes sense. Sometimes if you only want specific features that is the way to go. Thanks for sharing your design decision. |
Author: | Creepy [ Sat Jan 10, 2015 7:34 am ] |
Post subject: | Re: Languages, Softwares and code |
I see it's possible to access functions dynamically, can the same be done with variables? Code: loc.test.a1 = 123; loc.var_name = "a1"; loc.test.[loc.var_name] = 321; // just to show what I mean, it doesn't work like that |
Author: | xpadmin [ Sat Jan 10, 2015 9:19 am ] |
Post subject: | Re: Languages, Softwares and code |
Yes but the syntax is somewhat different: Code: loc.test.a1 = 123; loc.var_name = "a1"; *loc.test|loc.var_name = 321; The syntax for dynamic variables is: *prefix|var_name-postfix So you can also do: Code: loc.test.a1.b = 123; loc.var_name = "a1"; *loc.test|loc.var_name-b = 321; You can also do it yourself like this: Code: loc.test.a1 = 123; loc.var_name = "a1"; // Create string containing var name loc.s = "loc.test."; loc.s += loc.var_name; *loc.s = 321; |
Page 2 of 2 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |