Clone wiki

Core / setInstructionLimit

Back to Beyond the Codea in-app reference


FunctionIconFunction-Small.png setInstructionLimit() function

Introduction

Codea's setInstructionLimit(limit) function sets the maximum number of 'instructions' (limit) that the program will execute before stopping with the message:

error: Lua program has exceeded instruction limit Pausing playback

If the maximum number of 'instructions' is set as 0, setInstructionLimit(0), that is the equivalent of no limit.

Setting a limit can be used to protect against endless loops, for example. If used, setInstructionLimit() should be called in the setup() function.

Default

Before Codea version 1.2.7, the default was 3,000,000 'instructions'. From Codea version 1.2.7, the default is no limit.

Updated