As @danielbeard correctly stated this will not work as straightforwardly as expected on a desktop (or more permissive mobile) OS due to iOS sandboxing model, which effectively constrains application data to the application itself, although it is worth noting the issue at hand is not the sandboxing per se, which also exists in newer versions of OS X, but the fact iOS offers no unifying file system layer which is mirrored into applications’ sandboxes. You can plainly and pretty simply see that for yourself by editing a text document on your desktop in Lion’s TextEdit. TextEdit sees the document being located in its sandbox – ~/Library/Containers/com.apple.TextEdit/Data/Desktop
, but it is also clearly saved onto your desktop ~/Desktop
– at the same time; both directories are, for the purpose of the sandbox, one.

the cross-application file layer does not exist in iOS. This means that in iOS, it is not possible to edit one and the same physical copy of a file in multiple applications, as every app needs a copy in its own sandbox. It is however possible to “pass” files from app sandbox to app sandbox (strictly speaking: to copy them) via the “Open In” mechanism supported since iOS 3.2, as seen when opening Mail attachments in other apps.

If your app implements the ability to forward its .lua
documents via this mechanism, any text editor recognizing the file type can receive a copy into its own sandbox. I’m hazy as to implementation details, not being an iOS dev myself, but if the rules of UTI declaration from OS X and some stuff I have observed while using my iDevices holds true, you can even insert the file type into the public.text
UTI hierarchy in your own app, which will add support for it to all text editors on the device.
If the receiving editor implements “Open in” too, and your app has registered as being able to edit .lua
files, the editor can later copy the edited file back to your app’s sandbox. What happens there (de-duplication, versioning, overwriting with or without prompting) would be up to you, within the constraints imposed by the iOS SDK, which I know nothing about.
The following Apple Developer documents may provide a useful starting point: