Writing Plugins in Pure Lua

Writing Plugins in Pure Lua

Continuing our theme of making plugins more open, we want to make plugin development better by simplifying the way you package plugins written in pure Lua.

Previously, if you wanted to build a plugin, even if it only contained pure Lua code, you had to package it inside a native binary. This meant embedding the Lua bytecode into native source and compiling that into a native binary for each device platform (iOS, Android, etc) and each simulator platform (Mac and Win32)

Project Templates for Plugin Development

Today, we are offering you project templates that allow you to use Corona SDK, so that you can avoid all of that hassle. This way, you can easily write plugins and distribute them in the Corona Store as free plugins (and later this year, as purchasable plugins).

We have posted 2 plugin project templates on github:

These project templates are designed so you can edit the plugin’s Lua code just like you would a normal Corona project. Also, we made sure that you can use them on both Mac and Windows. For example, the helper scripts have both Mac and Win variants, like the one to create a new plugin project: create_project.sh (Mac) and create_project.bat (Win).

Packaging Plugins for Distribution

For Corona Store distribution, we’ve also included packaging scripts (build.sh for Mac and build.bat for Win) that allow you to package your plugin for submission to the Corona Store. This includes logistics like directory folder structure, a stub metadata file for you to fill in, compiling Lua sources down to bytecode, etc. Full details on submission/packaging guidelines are in the respective README’s for each template.

Once a plugin is on the Corona Store, the plugins get bundled into the final .app/.apk automatically by the Corona Build Server.

If you are working on a plugin, we are accepting applications for free plugins (support for purchasable plugins coming later this year): Corona Store application form

Plugin Docs

As part of distributing a plugin, you’ll want to write plugin documentation. To make this as easy as possible, we’ve created documentation templates that you can fork on Github, each corresponding to the plugin project templates I mentioned earlier:

When you use these doc templates, you get web hosting for free. All you have to do is create a public Github repo and the Github site renders the HTML for you.

Useful for personal/private development too

We think these project templates should also be used more generally, even if you are just creating Lua modules for your own app or game project.

When you create a new plugin project, you may notice that the actual plugin files look just like the standard Lua-based module you might write in your own project.

The differences are merely structural, rather than technical. They may seem small, but over time will help you be more productive, such as being able to test this module separately from your actual Corona app project. That clean separation also means you’ll be able to use it multiple Corona app projects without worrying about some accidental code dependency being injected.

And who knows? You might decide to publish this module someday as a plugin on the Corona Store. In that case, there are already scripts that come with the project, ready to package your plugin for submission.

  • Serkan Aksit
    Posted at 14:15h, 22 May

    Great news!

    I think this means there will be more cross-promotion/ad network options for us 🙂 Hope that will be the case. Looking forward to trying out those plugins as soon as possible.

  • adrian
    Posted at 15:38h, 26 May

    Sarkan, Ad network plugins are not allowed. Please read:


    And the question What type of plugins can I make?

    • Michael W.
      Posted at 13:15h, 28 May

      Hi Adrian,

      Your main limitations for writing plugins in pure Lua are your resourcefulness and the lua language.

      Pretty much anything from the Corona Code Exchange or the libraries found on our forums could be turned into Lua plugins.

      We have two types of plugin templates to help you out: Library and Shader. With the Shader template, you can start writing your own shaders to share with the community. With the Library template, you can write helper modules, game engines, new UI schemas, or a variety of other modules.

      If you have any questions, feel free to let us know on the forums. 🙂

      Michael Wallar

  • PiotrZ
    Posted at 05:58h, 05 June

    There is some mistake in creating project using create_project.bat on Windows.

    build.bat and build.sh are not copied to new project folder! Using this bat file, mentioned files are copied into folder named ‘test’, which appears next to folder containing create_project.bat file.
    This 2 files are missing from folder where new project was created!

    • Michael W.
      Posted at 13:42h, 08 June

      Hi PiotrZ,

      This issue has been fixed. Download the latest version of the plugin template creator and it should copy just fine on Windows.

      Michael Wallar