From 57ce499055f02fcdf133fbb19c66e0ad7d178424 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Mon, 1 Apr 2013 14:51:22 +0200 Subject: [PATCH] adg-web: load piston.lua from $(dirname adg-web.lua) --- adg-web.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/adg-web.lua b/adg-web.lua index b2a7bc0..19a2d1c 100644 --- a/adg-web.lua +++ b/adg-web.lua @@ -21,9 +21,20 @@ Boston, MA 02110-1301, USA. ]] +-- Convenient function to load scripts from the same directory +-- of this very same file +local function local_require(filename) + local FILE = arg[0] + local basedir = FILE and FILE:match('^(.*/).*$') or './' + local filename = basedir .. filename .. '.lua' + return assert(loadfile(filename)()) +end + + local lgi = require 'lgi' local Adg = lgi.require 'Adg' -local Piston = require 'piston' +local Piston = local_require 'piston' + -- Command line parsing -- 2.11.4.GIT