A script manages a hierarchical collection of threads.
Constructor
crystal.Script:new(startup_function)
The startup_function parameter is optional. If specified, the script will start with one top-level thread set to execute this function. This parameter is effectively a short hand for:
localscript=crystal.Script:new();script:add_thread(function(self)whiletruethenprint("Oink");self:wait_frame();endend);script:add_thread(function(self)whiletruethenprint("Moo");self:wait_frame();endend);script:update(0);-- Prints "Oink" and "Moo" (in any order)script:update(0);-- Prints "Oink" and "Moo" (in any order)script:update(0);-- Prints "Oink" and "Moo" (in any order)