Building Plugins

Building Plugins

Infomancer Forge is designed to be be highly customizable. Wish this in mind as much of the base functionality as we could has been built through the plugin engine.
There are some plugins that are just Lua modules that you can use from others. Think of those as libraries. Then there are plugins that will expand the UI and add new functions to the system.
⚠️
We have tried as much as possible to make building plugins easy if you have specific questions please get in touch on Discord and we will assist as well as update the documents to be clearer.
Plugin are now installed from an online repository. It is available from here.
notion image

Building a plugin

All plugins are added to your project in the Plugins folder.
The current base plugins look like this.
notion image
There is a plugin called Export this one is the base exported for data into Lua or JSON files. There is also a folder for raw modules that have been imported. Any folder called Modules will make each module available. Modules are not loaded into the Lua environment unless they are referenced through a plugin.
So in the above the exportInit.lua is executed and it will bring in the modules it needs. Those modules might include others and so on.
⚠️
There is no support for recursive importing. So Module A can not import Module B that then imports Module A.

Modules

Modules are like libraries in Lua. You import them into your code as follows.
local table=require("tables")
The above will execute the code in the module tables.lua and the return from that will be set to the local value table. Note that if you include a module multiple times it will only be created once and each of the includes shares that same module.

Example of adding a Menu item

So from within Lua you can add menu items to the interface. There are plans to be able to add buttons to views and other parts of the solution. But for now it’s limited to Menu items.
This code below adds the export feature to the menu for JSON.
local ui=require("ui") local export=require("export") ui.addMenuAction({ actionId="project.export.json", name="To Json", path="Project/Export", icon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.0429 23.968C12.5219 23.964 12.9959 23.939 13.4689 23.874C14.5524 23.7333 15.6112 23.4429 16.6149 23.011C18.0256 22.4057 19.3117 21.5437 20.4079 20.469C21.417 19.4796 22.2431 18.3193 22.8479 17.042C23.3649 15.9428 23.7089 14.7703 23.8679 13.566C24.0169 12.406 24.0029 11.22 23.8229 10.067C23.6726 9.10895 23.4063 8.17274 23.0299 7.279C22.7898 6.71761 22.5042 6.17681 22.1759 5.662C21.0079 3.825 19.3149 2.348 17.3659 1.362C16.6699 1.00647 15.9429 0.715262 15.1939 0.491995H15.1889C15.3079 0.554995 15.4289 0.623995 15.5339 0.692995C15.6539 0.766995 15.7729 0.838995 15.8849 0.917995C16.4539 1.30004 16.977 1.74631 17.4439 2.248C18.5069 3.393 19.2409 4.796 19.6619 6.289C19.9459 7.271 20.0959 8.28699 20.1569 9.30599C20.2009 10.049 20.2009 10.797 20.1099 11.535C19.9609 12.805 19.5559 14.045 18.8819 15.131C18.3856 15.9402 17.7398 16.6475 16.9789 17.215C15.7349 18.143 14.1019 18.697 12.5429 18.329C12.2855 18.2685 12.0349 18.182 11.7949 18.071C11.5214 17.9463 11.2605 17.7956 11.0159 17.621C10.5525 17.3114 10.134 16.9396 9.77189 16.516C9.33264 15.9924 8.97863 15.4028 8.72289 14.769C8.40963 13.9581 8.24239 13.0982 8.22889 12.229C8.19889 10.956 8.45389 9.676 9.08289 8.559C9.50425 7.8155 10.0696 7.16346 10.7459 6.641C10.9709 6.463 11.2099 6.308 11.4499 6.162L11.4659 6.155C10.9936 6.04704 10.5085 6.00664 10.0249 6.035C9.60707 6.06287 9.19446 6.14351 8.79689 6.275C8.43789 6.395 8.09289 6.545 7.77789 6.725C7.52201 6.87186 7.27705 7.03695 7.04489 7.219C6.83389 7.399 6.62489 7.579 6.42989 7.774C5.30689 8.927 4.66189 10.456 4.40789 12.03C4.25789 13.003 4.25789 13.99 4.31689 14.98C4.42189 16.375 4.70789 17.767 5.26189 19.042C5.59932 19.83 6.05377 20.5626 6.60989 21.215C7.46084 22.1978 8.5348 22.9624 9.74189 23.445C10.418 23.7214 11.1291 23.9031 11.8549 23.985C11.9289 24 12.0039 24 12.0639 24L12.0429 23.968ZM9.10889 23.57C8.95435 23.5033 8.80407 23.4272 8.65889 23.342C7.90626 22.9361 7.21919 22.4189 6.62089 21.808C5.52689 20.671 4.79389 19.242 4.37389 17.728C4.09726 16.6911 3.93133 15.6278 3.87889 14.556C3.83456 13.862 3.84995 13.1654 3.92489 12.474C4.05989 11.217 4.41989 9.973 5.04889 8.894C5.50092 8.098 6.10706 7.40007 6.83189 6.841C7.32799 6.46078 7.87849 6.15738 8.46489 5.941C9.60034 5.5299 10.8413 5.51405 11.9869 5.896C12.0159 5.896 12.0159 5.896 12.0319 5.926C12.0469 5.941 12.0769 5.941 12.0919 5.956C12.1369 5.972 12.1959 6.001 12.2569 6.03C12.4959 6.15 12.7359 6.301 12.9609 6.45C13.8678 7.08505 14.5911 7.94808 15.0579 8.95199C15.4779 9.86599 15.6729 10.886 15.6889 11.89C15.7029 12.969 15.5089 14.047 15.0439 15.036C14.4768 16.2289 13.5556 17.2178 12.4059 17.868C12.4959 17.898 12.5859 17.913 12.6769 17.943C12.9019 17.987 13.1259 18.017 13.3649 18.017C14.8329 18.062 16.2569 17.357 17.3049 16.37C17.4999 16.19 17.6799 15.995 17.8449 15.785C18.0699 15.515 18.2799 15.245 18.4589 14.962C18.6979 14.587 18.8939 14.212 19.0729 13.808C19.3017 13.2732 19.4724 12.7153 19.5819 12.144C19.7779 11.14 19.7929 10.122 19.7309 9.118C19.5959 7.096 19.0579 5.073 17.8889 3.394C17.716 3.14519 17.5308 2.90523 17.3339 2.675C17.006 2.30415 16.6507 1.95851 16.2709 1.641C15.8472 1.29262 15.3908 0.98618 14.9079 0.725995C14.3631 0.475987 13.7968 0.275836 13.2159 0.127995L12.9159 0.0679951C12.7069 0.0379951 12.4959 0.0239951 12.2819 0.00799513C11.9435 -0.00701003 11.6046 -0.00166707 11.2669 0.0239951C10.5629 0.0689951 9.85489 0.183995 9.15489 0.360995C5.79889 1.227 2.86289 3.566 1.29989 6.67C0.801121 7.65883 0.443633 8.71278 0.237887 9.80099C0.000955999 11.0456 -0.0341595 12.3202 0.133887 13.576C0.253887 14.596 0.507886 15.599 0.911887 16.553C1.13889 17.123 1.42289 17.677 1.73689 18.201C2.83089 19.984 4.41989 21.437 6.24689 22.441C6.93489 22.831 7.65489 23.131 8.40389 23.385C8.62989 23.459 8.85389 23.535 9.09289 23.595L9.10889 23.57Z" fill="black"/></svg>', -- actionType="Menu", -- targetId=gobs.Dialog.uuid, adjustColors=true, action=function() export.toJson() end })
First we import uiand export . Export is a module that is part of the Export plugin while ui is a module that assists wiring up Lua tot he User Interface. More through information on the modules can be found here.
 
 
Built with Potion.so