[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

passing values between Lua scripts



Hi
A question about combining pre- & post-processor scripts.
I don't know much yet about Lua, but when we use a FOR loop in a pre- 
processor script to invoke a post-processor script, I think these are 
separate instances of Lua and don't share data. Is that correct?

For instance, assume you move a block incrementally in a pre-
processor FOR loop, then find the force on the block in a post-
processor script. You can keep track of the block's position in the 
pre script and print it to file. You can also print the force on the 
block at the current position while in the post-processor file. 
However, to create a list of force vs. position as the iteration 
continues, you have to keep opening & closing the file as you shuttle 
between the pre- & post-processor scripts, because they don't share 
variables: is that correct? It seems very messy.

It would be better if the post-processor script could query the 
position of the block, then write the position and corresponding 
force at the same time. I can't see how to do this. Looking 
throught manual.pdf, I can't find a command which queries the current 
position of a given point. Selectnode doesn't seem to be appropriate 
(in general) because it is a proximity command (therefore when the 
block moves away from the reference point, the command will start 
selecting the wrong node). Secondly, even if a particular node or 
segment could be selected, it seems you can set its properties but 
not query them. Is this correct? Is there a better way?

Thanks
Ross