Lua was getting this variable without being told it is a number rather than a string. On some systems it is interpreted as a string which breaks this monster spawner code and throws Lua error messages onto the player's screen.