Logic Machine Forum
Dividing project into modules in deamon directory - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Dividing project into modules in deamon directory (/showthread.php?tid=1931)



Dividing project into modules in deamon directory - buuuudzik - 25.02.2019

Hello,

is it possible to divide project in deamon directory and then require("./script1") like in NodeJS?


RE: Dividing project into modules in deamon directory - admin - 25.02.2019

You can either place libraries/code parts in store/libs directory, then you can load them the via:
Code:
require('applibs.mylib') -- custom.mylib for older versions

Or you can place them together with daemon but then you will need to specify full path. Use this short wrapper function:
Code:
function loadlib(path)
  return dofile('/data/apps/store/daemon/' .. path .. '.lua')
end

loadlib('myapp/mylib')



RE: Dividing project into modules in deamon directory - buuuudzik - 25.02.2019

ThanksWink