Ilias38rus 5 Posted November 20, 2015 _la = [{sleep 1}]; hint "t"; _la select 0; hint "t1"; or _la = [{sleep 1}]; hint "t"; _lsr = spawn (_la select 0); //_lsr = spawn {_la select 0}; | _lsr = spawn {(_la select 0)}; waituntil {skriptdone _lsr} hint "t1"; Do not working, how to do it? Share this post Link to post Share on other sites
Greenfist 1863 Posted November 20, 2015 _la = [{sleep 1}]; hint "t"; _lsr = [] spawn (_la select 0); waituntil {scriptdone _lsr} hint "t1"; Share this post Link to post Share on other sites
ianbanks 30 Posted November 20, 2015 Unlike call and execVM, spawn doesn't have a unary (right hand side argument only) version. You need to pass something (usually an empty array, which can later be extended to include arguments).Also you don't need to put code blocks into arrays. The execution of code in blocks is always delayed until some command (like call, spawn, waitUntil, etc) executes it. Share this post Link to post Share on other sites
Ilias38rus 5 Posted November 20, 2015 _la = [{sleep 1}]; hint "t"; _lsr = [] spawn (_la select 0); waituntil {scriptdone _lsr} hint "t1"; Unlike call and execVM, spawn doesn't have a unary (right hand side argument only) version. You need to pass something (usually an empty array, which can later be extended to include arguments). Also you don't need to put code blocks into arrays. The execution of code in blocks is always delayed until some command (like call, spawn, waitUntil, etc) executes it. Array is just example. Thank you both. Share this post Link to post Share on other sites
Ed! 13 Posted November 20, 2015 spawn makes it run in a different thread. call makes it run in the same thread. Share this post Link to post Share on other sites
KiloSwiss 16 Posted November 21, 2015 If this is just an example of how to store and call/execute code in a variable then: _la = {sleep 1}; hint "t"; call _la; hint "t1";Otherwise:hint "t"; sleep 1 hint "t1"; 1 Share this post Link to post Share on other sites
Ilias38rus 5 Posted November 22, 2015 spawn makes it run in a different thread. call makes it run in the same thread. Thank you, i should read it. Share this post Link to post Share on other sites