Proper limits are needed regardless of how the config is loaded. In this example I would expect add_body to fail after adding some number of objects well before the loop limit is encountered.
More troubling are loops which consume CPU without hitting memory limits. I would hope Lua provides a way to limit the number of instructions when evaluating expressions. If not then delegating reading the config to a limited subprocess could work at the cost of still more complexity.