diff --git a/Nasal/globals.nas b/Nasal/globals.nas index c7f79fa10..176d6bf63 100644 --- a/Nasal/globals.nas +++ b/Nasal/globals.nas @@ -136,23 +136,8 @@ _setlistener("/sim/signals/nasal-dir-initialized", func { if((var dir = directory(path)) == nil) return; foreach(var file; sort(dir, cmp)) { if(substr(file, -4) != ".nas") continue; - - var module = substr(file, 0, size(file) - 4); - file = path ~ "/" ~ file; printlog("info", ">>> executing local Nasal file ", file); - - if(!contains(globals, module)) var locals = globals[module] = {}; - elsif(typeof(globals[module]) == "hash") var locals = globals[module]; - else var locals = {}; - - var err = []; - var code = call(func { compile(io.readfile(file), file) }, nil, err); - if(size(err)) { - print(file ~ ": " ~ err[0]); - continue; - } - call(bind(code, globals), nil, nil, locals, err); - debug.printerror(err); + io.load_nasal(path ~ "/" ~ file); } });