Page 1 of 1

Use external libraries

Posted: Wed Nov 28, 2018 11:12 pm
by Hermios
Hi
I assume this is a basic question, but I couldn't find the info anywhere:
How can I handle external libs, on the same concept than bob's mods. Indeed, the bob's library is required for all the other mods. But I couldn't find how he refers to it.
Any help?
Many thanks

Niko

Re: Use external libraries

Posted: Wed Nov 28, 2018 11:19 pm
by DaveMcW
Every variable and function used in the data.lua stage is global, unless it is explicitly declared as local. This means you can use variables and functions defined in another mod with no extra effort.

Add the library mod as a dependency in info.json to make sure it loads first.

Control.lua enforces a sandbox around mods, you can only share data by using LuaRemote.

Re: Use external libraries

Posted: Thu Nov 29, 2018 12:15 am
by eradicator
Dependencies are defined in info.json as "[? optional marker, (?) hidden optional marker or ! incompatibility marker] mod-name [comparator, version]".

Code: Select all

  "dependencies"    : [
    "base >= 0.16.25",
    "mandatory-mod-name",
    "? optional-mod-name > 1.2.3"
    ]

Re: Use external libraries

Posted: Wed Jan 09, 2019 3:27 pm
by Hermios
Great, many thanks for the answers, especially data.lua!
I'll implement it in the next version of my mods

Niko