Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by mahgo

Hi, how do I set values of an array variable property of an Entity in Weltmeister?

1 decade ago by Joncom

As far as I know, you cannot set values of arrays, only objects. And you use dot-notation to do so. For example foo.bar with a value of "hello" would set entity.foo.bar to "hello".

1 decade ago by drhayes

Joncom is right, but I'm pretty sure you can cheat because JS arrays are objects underneath the covers.

You can&039;t use index 0 because WM will coerce it to null, but if you use #foo.1 as the key you will set foo[1]. Et voilĂ !

If you don&039;t care about order, though, an object is just fine for storing a collection of values. You can still iterate over the object's keys to get what you want using #for (var key in obj) {....
Page 1 of 1
« first « previous next › last »