robbielyman / seamstress

seamstress is an art engine
GNU General Public License v3.0
123 stars 12 forks source link

feat: `include` #40

Closed p3r7 closed 1 year ago

p3r7 commented 1 year ago

norns provide the include helper, that works like require but doesn't cache (uses dofile) and allows sourcing libs from the current script's folder (e.g. include("/lib/toto")).

most norns script rely on it instead of require for their own modules. having this helper fn would help porting norns libs to seamstress.

this PR also introduces seamstress.state.path, the path of the current script's folder (needed for requiring from current script's path).

as an added bonus we also get seamstress.state.script (absolute path to current script) and seamstress.state.name (script file name sans ext), behaving like norns' norns.state.<var>.