Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5977753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:24:57+00:00 2026-05-22T21:24:57+00:00

I am implementing a plugin system with Lua scripts for an application. Basically it

  • 0

I am implementing a plugin system with Lua scripts for an application. Basically it will allow the users to extend the functionality by defining one or more functions in Lua. The plugin function will be called in response to an application event.

Are there some good open source plugin frameworks in Lua that can serve as a model?

In particular I wonder what is the best way to pass parameters to the plugin and receive the returned values, in a way that is both flexible and easy to use for the plugin writers.

Just to clarify, I am interested in the design of the API from the point of view of the script programming in Lua, not from the point of view of the hosting application.

Any other advice or best practices related to the design of a plugin system in Lua will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:24:58+00:00Added an answer on May 22, 2026 at 9:24 pm

    Lua’s first-class functions make this kind of thing so simple that I think you won’t find much in the way of frameworks. Remember that Lua’s mantra is to provide minimal mechanism and let individual programmers work out policy for themselves.

    Your question is very general, but here’s what I recommend for your API:

    • A single plugin should be represented by a single Lua table (just as a Lua module is represented by a single table).

    • The fields of the table should contain operations or callbacks of the table.

    • Shared state should not be stored in the table; it should be stored in local variables of the code that creates the table, e.g.,

      local initialized = false
      
      return {
         init = function(self, t) ... ; initialized = true end,
         something_else = function (self, t) 
                            if not initialized then error(...) end
                            ... 
                          end,
         ...
      }
      
    • You’ll also see that I recommend all plugin operations use the same interface:

      1. The first argument to the plugin is the table itself
      2. The only other argument is a table containing all other information needed by the operation.
      3. Finally, each operation should return a result table.

      The reason for passing and returning a single table instead of positional results is that it will help you keep code compatible as interfaces evolve.

    In summary, use tables and first-class functions aggressively, and protect your plugin’s private state.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any jquery plugin for implementing iGoogle style dashboard? So basically drag n
My application allows users to write plugins (implementing IPlugin) that they can instantiate at
I am implementing camera application using then example comes with blackberry plugin for eclipse
I'm currently implementing a plugin to manage quotation requests in a magento shop system.
I'm writing an application that includes a plugin system in a different assembly. The
I am implementing a simple plugin architecture in an application. The plugin requirements are
I am implementing a Facebook Registration Plugin. While in development locally and on one
I am currently implementing a photo snapshot function to allow users to set their
I'm implementing a plugin architecture to implement authentication an external authentication mechanism for a
I'm implementing a jquery plugin ( localscroll ) to smooth scroll to named anchor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.