Posted on by

FAQ IconWednesday calls for another session on frequently asked questions (FAQs). Today we cover FAQs about Corona SDK Plugins.

1. How do plugins work?

Plugins are stored on Corona Labs’ server and linked into your project when you do a build. To add a plugin to your project, you need to do two things: 1) add the plugin name to the build.settings file, and 2) add a “require” statement to your main.lua file to load the plugin code.

The build.settings file.

settings =
{
    plugins =
    {
        -- key is the name passed to Lua's 'require()'
        ["plugin.zip"] =
        {
            -- required
            publisherId = "com.coronalabs",
        },
    },      
}

The main.lua file.

local zip = require( "plugin.zip" )

Visit the documentation for the plugin to determine the extract information needed. You can find plugin documentation here.

The great thing about plugins is they are only added to your project when needed. This reduces the size of your app by eliminating unneeded code.

2. Are plugins available for everyone?

Most plugins are only available to Pro users but there are some plugins available to Starter users. The “Availability” line at the top of the plugin’s main document page (index.html) indicates who can use the plugin. You can also see the plugin availability in the Corona Plugin Directory.

3. I’m trying to use a plugin in my project and it’s giving me an error. What’s wrong?

There are a number of potential reasons for plugin errors. Check the following:

  • If you are a Starter user, make sure you are authorized to use the plugin (check Availability).
  • Make sure you are using the proper Corona SDK build for the plugin. Some plugins require features/bug fixes only available starting with a specific build number. Most plugins work with the recent Public Build, but you should check this if you are getting a “plugin not available” error.
  • Is the plugin available for the platform you’re building for? If the plugin is only available for Android, you will get a build error when building for iOS or iOS Simulator.
  • Double check your code and make sure you’re using the correct calls for the plugin. All the plugins have sample code available, so it’s a good idea to download and run the vendor’s sample code to make sure that is working if you’re having problems.

Most plugins are written and supported by third party vendors. Check out our Plugin Forum for more information and please post questions for the vendors and other users.

4. Will I always get the most up-to-date plugin when I build my project?

The system will download and build with the latest plugin for the version of Corona SDK you’re running. The plugins are tied to the Corona build number so when you open a project that requires a plugin, the simulator checks to see if you have the most recent plugin module on your machine and downloads the latest version. When you do a build, the plugins for the build platform is linked into your project from our servers. This ensures you are always using the latest plugin version.

5. Can I write my own plugin?

Currently, plugins are provided by official partners, or by Corona Labs. In the near future, we plan to roll out a full plugin marketplace where any developer can submit plugins for sale. If you are serious about developing a plugin, please email us at partnerships@coronalabs.com and tell us what you have in mind. 


Posted by . Thanks for reading...

4 Responses to “Wednesday FAQs: Corona SDK Plugins”

  1. aukStudios

    I wanted to ask two clarifying questions about this post. I’m writing it here, rather than in the forums, because I think these questions will be of interest to anyone reading the blog post.

    1. Can you clarify #4 a bit more? Let’s suppose I ‘freeze’ my development with Daily Build 1179, and I don’t update Corona even as new daily builds become available. Will the version of the plugins I use also be frozen? Or will new versions of the plugins be applied ‘retroactively’? It’s not clear to me, because the statement that “plugins are tied to the Corona build number” and the statement that “you are always using the latest plugin version” seem inconsistent. Here’s my concern: if I freeze development with a particular daily build, will I be at risk of bugs being introduced because a plugin was updated to a new version, and that new version had a bug in it or made a breaking change to the API?

    2. Are there plans to publish changelogs for plugins (both those created by Corona and those created by third parties), similar to the Daily Builds changelog? That would help bring transparency to developers about bug fixes or API changes in plugins and partly mitigate the concern I mentioned above

    Overall, though, I’m very happy to see that the plugin framework is working well and that the menu of plugins is growing. Thanks!

    – Andrew

    Reply
  2. David MEKERSA

    It’s amazing to read that Corona is now more and more open to external libs.
    However, I see there some “not so famous” partners, and not plugins like Chartboost…

    Reply
  3. David MEKERSA

    For those looking how to avoid an error when building for Android with a build.settings including an iPhone plugin:

    Add this
    supportedPlatforms = { iphone = true },

    right below
    publisherId = “com.coronalabs”,

    Reply

Leave a Reply

  • (Will Not Be Published)