Skip to content

system.getInstructionsUsage

since 26.1.3

Return the percentage of Lua instructions already used in the current script execution cycle.

local usage = system.getInstructionsUsage()

Parameters

None.

Returns

usage (integer): 0 to 100, the script is aborted when reaching 100

Examples

From the official Ethos documentation
local function wakeup()
  while system.getInstructionsUsage() < 80 do
    -- process the next chunk of a long task
  end
end