diff options
Diffstat (limited to 'script/vm/node/init.lua')
-rw-r--r-- | script/vm/node/init.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/script/vm/node/init.lua b/script/vm/node/init.lua new file mode 100644 index 00000000..524dab4e --- /dev/null +++ b/script/vm/node/init.lua @@ -0,0 +1,22 @@ +local files = require 'files' +local compiler = require 'vm.node.compiler' +local vmState = require 'vm.state' + +for uri in files.eachFile() do + local state = files.getState(uri) + if state then + compiler.compileGlobals(state.ast) + end +end + +files.watch(function (ev, uri) + if ev == 'update' then + local state = files.getState(uri) + if state then + compiler.compileGlobals(state.ast) + end + end + if ev == 'remove' then + vmState.dropUri(uri) + end +end) |