lua - Computercraft Evaluate and Execute relative to ticks -


for sake of writing fast turtle programs, wondering how, in relation ticks, code executed? there tick penalty executing functions or evaluating other lua statements in addition time takes turtle move? in other words, take same amount of time (assuming if statements evaluate false):

turtle.forward() if turtle.getfuellevel() == 0 turtle.refuel() end turtle.forward() 

this:

turtle.forward() if x < 20 turtle.refuel() end turtle.forward() x = x+1 

and

turtle.forward() turtle.forward() 

? thanks

edit:

according eric, interfaces minecraft take tick, operations raw lua not. in other words, first example takes 2 ticks (in addition multi-tick move), second takes 1 tick, , final has no ticks.

usually, things trigger sort of tick, or cause sizable amount of stoppage tick pass pulling events (os.pullevent,os.pulleventraw,coroutine.yield) turtle movement of course need tick go by, , call coroutine.yield pause script , move.

the thing technical sides of computercraft better answered close mod , know lot it. not many frequent have kind of knowledge. if want know everything, ask on cc forums it.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -