[Solved] Is there no way to make library for control.lua?
Posted: Wed Aug 03, 2016 4:35 pm
Just to make sure, is there no way to make shared functions that can be used by control.lua from another mod?
Bob's library shows that it is possible to make library for data.lua, but I can't get it to work when making my library for control.lua. If I add require "the file from the library mod" in control.lua, it complains for no such file. I have tried
Edit:
The answer is: you can actually make library mod for control.lua.
The trick is to use remote.add_interface in your library mod, and use remote.call in the other mods.
See the API doc for more details.
Thanks DedlySpyder for the answer.
Bob's library shows that it is possible to make library for data.lua, but I can't get it to work when making my library for control.lua. If I add require "the file from the library mod" in control.lua, it complains for no such file. I have tried
- require "file-name"
- require "mod-name/file-name"
- require "__mod-name__/file-name"
Edit:
The answer is: you can actually make library mod for control.lua.
The trick is to use remote.add_interface in your library mod, and use remote.call in the other mods.
See the API doc for more details.
Thanks DedlySpyder for the answer.