From 3d6c8e4c531569ddc6f32fc36e3ab60d7246335f Mon Sep 17 00:00:00 2001 From: osmarks Date: Fri, 29 Jan 2021 22:15:06 +0000 Subject: [PATCH] pass environment to heavlisp functions --- src/potatobios.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/potatobios.lua b/src/potatobios.lua index 15011c2..fd5937e 100644 --- a/src/potatobios.lua +++ b/src/potatobios.lua @@ -220,7 +220,7 @@ local load_log = {} local set_last_loaded = potatOS.set_last_loaded potatOS.set_last_loaded = nil -- Check safety of code. Also log executed code if Protocol Epsilon diagnostics mode is enabled. I should probably develop a better format. -function load(code, file, ...) +function load(code, file, mode, env) local start, end_, pxsig = code:find "%-%-%-PXSIG:([0-9A-Fa-f]+)\n" if pxsig then local rest = code:sub(1, start - 1) .. code:sub(end_ + 1) @@ -247,11 +247,11 @@ function load(code, file, ...) local ok, ast = pcall(function() return heavlisp.into_ast(heavlisp.tokenize(code)) end) if not ok then return false, ast end return function(imports) - imports = imports or {} + imports = imports or env or {} return heavlisp.interpret(ast, imports) end end - return real_load(code, file, ...) + return real_load(code, file, mode, env) end do_something "load"