Lua Processor

Building Type

CPU

Build Gun In Game
300
300

The Lua Processor allows you to run Lua Code and requires a Lua EEPROM for boot code. This code is like the BIOS for your computer. The Lua Processor uses the Lua Interface so you can code complex programs interacting with your factory.

The different tiers of CPUs provide different speeds of code execution. Limiting the execution time of a CPU works by limiting the amount of lua code increments executed per factory tick. While such a tick occures it goes through two tick states. The first state simply runs a couple of code increments unlimited. After this amount of code increments it enters the second state which will cause the tick to end when a API call (not standard Lua function) occurs. But when the tick doesn’t end until a specific amount of code increments occur, the system will crash with a out of time exception. That means, when you make a infinite loop without any api calls. The system will crash, but if you do a API call like print(), it will run as intended.

Rightnow this code executions occurs in the factory tick and so synced with the game. And so provides thread safety.