Skip to content

3m0r1/Eclipse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eclipse

A Lua scripting environment tailored for complex plugin systems.

eclipse

Background

Eclipse started out as a way to interpret lua plugins as efficiently as possible to allow for dynamic behavior for systems like C2s, where extensibility matters alot.

It focuses on 4 main components when it comes to plugin design:

  • Events
  • Commands
  • Imports
  • Exports

It was designed for the Abyss C2 Framework.

Features

Events

  • Lifecycle events (OnLoad, OnUnload, OnReady)
  • Custom events

Commands

  • Variadiac & optional arguments
  • Strict mode
  • Variadiac returns

Imports

  • Clean syntax using __call metamethod

Exports

  • Ability to export commands with the Export field

Example

Manager:

mgr := manager.NewPluginManager()

basicPlugin := plugin.NewPlugin("./plugins/basic.lua")
mgr.LoadPlugins(basicPlugin)

basicPlugin.InvokeCommand("Greet", lua.LString("World"))

Plugin:

function OnLoad()
    print('Loading greet plugin')
end

function OnUnload()
    print('Unloading greet plugin')
end

function OnReady(plugin)
    print('greet plugin is ready')
end

return {
    Metadata = {
        Name = 'GreetPlugin',
        Description = 'Plugin that has commands related to greeting',
        Author = '3m0r1',
        Version = '1.0.0'
    },

    Events = {
        OnLoad = OnLoad,
        OnUnload = OnUnload,
        OnReady = OnReady
    },

    Commands = {
        Greet = {
            Description = 'Greets the user',
            Use = 'Greet [user]',
            Args = {
                {
                    Name = 'user',
                    Default = 'DefaultUser',
                    Optional = true,
                }
            },
            Strict = true, -- allow only the exact number of argsument(s)?
            Return = false, -- are there return(s)?
            Export = false, -- make it importable by other plugin(s)?

           -- ctx refers to the local plugin (most of the time) commands are invoked
            Run = function(ctx, args)
                print('Hello:', args[1])
            end
        }
    },

    Imports = { }
}

For more details, check out the Plugins folder.

Usage

./eclipse [plugins]

Resources

These resources were crucial during the development of Eclipse.

About

A Lua scripting environment tailored for complex plugin systems.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published