sys_curfile [function]

sys_curfile()

returns the 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)

// a.sgs
print( sys_curfile() ); // prints "a.sgs"
// b.sgs
include "a.sgs";