sys_curfiledir [function]

sys_curfiledir()

returns the directory path of the file (as passed on load) that contains the currently executed code or null if the file cannot be determined (eval, C functions)

// ext/a.sgs
print( sys_curfiledir() ); // prints "ext"
// a.sgs
print( sys_curfiledir() ); // prints "."
// b.sgs
include "ext/a.sgs", "a.sgs";