Lua is slow at concatenation since it's strings are immutable.  Try `("box[%d,%d;%d,%d;%s]"):format(...)`.