MDK
MDK copied to clipboard
Including MDK in my package
I am referring to this part of README.md
## Installation
### I am a package author looking to include/use one of the MDK modules or classes in my package
You should download the `demonnic-MDK-<version>.zip` file for your desired release on the [Releases](https://github.com/demonnic/MDK/releases) page.
Inside are the individual .lua files for the modules and classes described in the [wiki](https://demonnic.github.io/mdk/current/) and [API docs](https://demonnic.github.io/mdk/current/).
You can include all of them if you wish, or only the ones you actually make use of. I ask that you include the LICENSE.lua or LICENSE-MDK.lua file (depending on the release) file in addition.
They should go in the root of your package, so that when your package is installed the files can be found at `getMudletHomeDir() .. "/<packagename>/emco.lua"`. You would then use `local EMCO = require("<mypackagename>.emco")`
So for example if your package name is "MySuperCoolPackage" and it installs to `getMudletHomeDir() .. "/MySuperCoolPackage/"` then you use `local EMCO = require("MySuperCoolPackage.emco")` and the emco.lua file should be at `getMudletHomeDir() .. "/MySuperCoolPackage/emco.lua"`
I wanted to include EMCO, but I am weary of dropping too many files in my root of my package. So here is what I did instead:
I renamed emco.lua to init.lua and put it in a directory "emco" which is located in the root as well.
So to continue your quoted example from above, the file would be at
getMudletHomeDir() .. "/MySuperCoolPackage/emco/init.lua"
The great thing about this, it's not only neatly organized like this, but also your command still works:
local EMCO = require("MySuperCoolPackage.emco")
I thought I wanted to share this with you, as it was not immediately obvious to me. Maybe you want to include. Or not. Bye!
It does not work quite as nice as expected. Because EMCO will require loggingconsole, which itself requires daemontools, too. So I need to put both those files in folders as well. Not sure why they are required, or why I did not find it in documentation before. When I tried to use EMCO, it seemed to work alright, but maybe some logging didn't. Also now I have 3 folders, and want to put LICENCE in each of them, that's some unexpected duplication now. Maybe this way to include MDK in my package is not so much easier to handle after all.
edit: Maybe then I will just settle for something like local EMCO = require("MySuperCoolPackage.demonnic.emco")
and group all three files in a "demonnic" folder
if it can't require loggingconsole (which uses some stuff from demontools) then it just goes on without the logging capabilities, yeah.