That's something that Apple forbids app developers from doing (unless the lua interpreter is running in a webview).
> 2.5.2 Apps should be self-contained in their bundles,
> and may not read or write data outside the designated
> container area, nor may they download, install, or
> execute code which introduces or changes features or
> functionality of the app, including other apps.
The wiggle room is in the "introduces or changes features or functionality of the app" line, they've given themselves vague discretion to reject things that download too much code, but there are tons of apps that do OTA updates that haven't been rejected because they aren't changing fundamental features/functionality.Having a self modifying app is a nightmare from a security & privacy standpoint.