Skip to content

Commit

Permalink
Revises query.lua to use df_shortcut_env
Browse files Browse the repository at this point in the history
Table lookups now use `df_shortcut_env` instead of `df_expr_to_ref`
This fixes a problem trying to index some vectors (probably all)
  • Loading branch information
cppcooper authored Feb 17, 2023
1 parent 0fe76c0 commit 4a0f2eb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion devel/query.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,19 @@ function main()
query(selection, path_info, args.search, path_info)
end

local eval_env = utils.df_shortcut_env()
function eval(s)
local f, err = load("return " .. s, "expression", "t", eval_env)
if err then qerror(err) end
return f()
end

function getSelectionData()
local selection = nil
local path_info = nil
if args.table then
debugf(0,"table selection")
selection = utils.df_expr_to_ref(args.table)
selection = eval(args.table)
path_info = args.table
path_info_pattern = escapeSpecialChars(path_info)
elseif args.json then
Expand Down

0 comments on commit 4a0f2eb

Please sign in to comment.