var result =new Object();
result.vars=new Object();function(__structure vars) main (__number a, __number b){
result.vars.a= a;
result.vars.b= b;return result;}
The result.vars._____ part is the variable name passed on (so result.vars.yanomano would set a variable called "yanomano")
Off topic question:
Any reason you're declaring result as a global variable instead of in the scope of the main function? Is there a performance gain not creating a new Object() every frame, or is it just your convention?
When optimizing, the most fundamental axiom is "do as little as possible" -- this goes for code, compositions, etc. One simple way to do so is to pull redundant stuff out of places that are executed repeatedly (like the main function).
JS, as an interpreted language (I'm pretty sure it's interpreted in QC -- in browsers and other places, they have hot-shot JIT compilers now, which should be rather snappy) benefits a lot from doing as little as possible. So I generally opt to have result get allocated exactly once, and then never deal with allocation again (allocation can be a bit expensive, and JS's garbage collector in QC sucks, so I try to avoid needing it as much as possible).
I'd guess that the performance gain is negligible in this case, but it's a habit I like to be in.
The result.vars._____ part is the variable name passed on (so result.vars.yanomano would set a variable called "yanomano")
This may be of use for ideas...
Thanks Chris ;)
Off topic question: Any reason you're declaring result as a global variable instead of in the scope of the main function? Is there a performance gain not creating a new Object() every frame, or is it just your convention?
When optimizing, the most fundamental axiom is "do as little as possible" -- this goes for code, compositions, etc. One simple way to do so is to pull redundant stuff out of places that are executed repeatedly (like the main function).
JS, as an interpreted language (I'm pretty sure it's interpreted in QC -- in browsers and other places, they have hot-shot JIT compilers now, which should be rather snappy) benefits a lot from doing as little as possible. So I generally opt to have result get allocated exactly once, and then never deal with allocation again (allocation can be a bit expensive, and JS's garbage collector in QC sucks, so I try to avoid needing it as much as possible).
I'd guess that the performance gain is negligible in this case, but it's a habit I like to be in.
for me working with structure maker, in that case the input keys names are the variables names. Maybe more simple then JS. Or not?:)
The Geometry of Sea Shells...procedural 3D modeling explain...;)
Hahah, I was actually breaking out notes I took in highschool and college (yes, I keep notes from that long ago.... I'm a sick, sick man....).