It seems that variables that a struct has been assigned to, hold a pointer to the data structure, rather than the data itself.
An example:
Code: Select all
(block (theNodes setFoo)
(setq setFoo (lambda (nodes index)
(block (nodes2 aNode)
(setq nodes2 nodes)
(setq theNode (item nodes2 index))
(set@ theNode 'foo "bar!")
)
))
(setq theNodes (list
{foo: 'a bar: 0}
{foo: 'b bar: 1}
{foo: 'c bar: 2}
{foo: 'd bar: 3}
{foo: 'e bar: 4}
))
(setFoo theNodes 3)
(enum theNodes node
(dbgLog "node: " node)
)
)
Code: Select all
09/13/2013 18:15:49 node: { bar:0 foo:a }
09/13/2013 18:15:49 node: { bar:1 foo:b }
09/13/2013 18:15:49 node: { bar:2 foo:c }
09/13/2013 18:15:49 node: { bar:3 foo:bar! }
09/13/2013 18:15:49 node: { bar:4 foo:e }
@George, can you please confirm if the above behaviour is as intended?
Cheers,
Pixelfck