This is a plugin project for pure Lua-based implementations (no native code).
In order to create a new project, there are multiple steps involved.
The first step is to run the following script. This script duplicates the files in this template and then replaces carrot
with the name of your plugin library.
Open a Terminal window in the directory for this project template. Then run the following command:
./create_project.sh /path/to/new/project/folder carrot
Note that carrot
should correspond to the name of (e.g. 'openudid') as described in the Plugin Submission Guidelines.
Your library file should go into the Lua file located in the shared/
directory.
The Lua file is a stub that instantiates a [CoronaLibrary][api.type.CoronaLibrary] instance for you. There is a section in the middle that contains a stub example function. You can replace that with your library functions.
In each file there are strings in ALL CAPS that should be replaced with information specific to your plugin.
While the helper script has already done a replacement of carrot
for you, there are still several strings that need to be updated.
Please see the section Replacing strings in ALL CAPS
in the Plugin Submission Guidelines for a complete list.
- metadata.json
- shared/plugin_xxxx.lua
- Corona/build.settings
If you've finished the steps mentioned in 'Updating the project', then you are ready to submit.
There is a convenience script that takes care of building and packaging:
-
Building. The script will build native plugins for iOS and Android. For the Corona Simulator, it will simply copy your Lua file.
-
Packaging. The script also copies all the files to the desired folder structure described in the Plugin Submission Guidelines.
To run the script, open a Terminal to your project's root folder. There should be a script called build.sh
that you can run:
./build.sh
This will create several files:
- a
build
folder - a
build/sdk
folder - a zip file in
build/
that will contain all the files inbuild/sdk
. This is the file you should submit.
The following assumes you have used the create_project.sh
utility above to create a new project.
There is a main.lua
file in the Corona
directory. The code in this folder will access your plugin's functionality.
You should modify this code to access functionality offered by your plugin.
Open the 'ios/PluginTestApp.xcodeproj' of your project. You can then launch a test app via Xcode.
Open a Terminal into the android
directory of your project and run the build_app.sh
shell script. This will build an unsigned .apk in the bin/
folder. You can sign this with jarsigner and install on your device for testing.