Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eval): track source history #401

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions process/eval.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ return function (ao)
return function (msg)
-- exec expression
local expr = msg.Data
local func, err = load("return " .. expr, 'aos', 't', _G)
local func, err = load("return " .. expr, msg.Id, 't', _G)
local output = ""
local e = nil
if err then
func, err = load(expr, 'aos', 't', _G)
func, err = load(expr, msg.Id, 't', _G)
end
if func then
output, e = func()
Expand All @@ -44,5 +44,10 @@ return function (ao)
}

end
-- add ability to keep track of eval source history
if _TRACK_EVAL_HISTORY == true then
_SOURCES = _SOURCES or {}
_SOURCES[msg.Id] = msg.Data
end
end
end