ls:ask
ls:ask model-or-list-of-models command argument
Ask the given child model or list of child models to run the given command. This is the primary of doing things with child models. For example:
ls:ask model-id [ create-turtles 5 ]
You can also ask a list of models to all do the same thing:
ls:ask ls:models [ create-turtles 5 ]
You may supply the command with arguments, just like you would with anonymous commands:
let turtle-id 0
let speed 5
(ls:ask model-id [ [t s] -> ask turtle t [ fd s ] ] turtle-id speed)
Note that the commands cannot access variables in the parent model directly. You must either pass information in through arguments or using ls:let
.
Take me to the full LevelSpace Extension Dictionary