Add a shared table to the lua envirorment.

  • Project Moderator

    Add a shared table to the lua script envirorment.
    Add a table that is shared between all lua scripts so scripts can exchanged data and functions.
    This feature should be added to the client, so plugin developers can offer functionality or data to different plugins.
    An example would be creating and sharing a function called registerCommand in @Rektinator 's PlutoAdmin script and using it in a different script to add a command to his script if it is used on the server. That way our script could either run as a stand alone plugin or as a addon of PlutoAdmin script.

    Expose a function:

    function registerCommand(name, alias, level, funcName, func)
        newCMD = {} = name
        newCMD.alias = alias
        newCMD.level = level
        newCMD.func = funcName
        newCMD.enabled = true
        table.insert(settingshandler.settings.commands, newCMD)
        commands[funcName] = func
    _S.pa_registerCommand = registerCommand

    Using the exposed function:

    if _S.pa_registerCommand ~= nil then
        -- Register callbacks and provide our functionality as a (chat) command on our own.

  • Banned

    Sounds pretty neat tbh