如何将 table 参数传递给使用 load 创建的函数?

How do i pass a table parameter to a function created with load?

不使用负载,我会有这个来源:

function dosearch(t)
   t:search()
end

并用

调用它
dosearch(my_search_t)

但是,我想使用加载来评估包含上述代码的字符串。

codestr = "t:search()"
searchfunc = load(codestr)

最后调用它:

function callsearch(t)
  -- How to use debug.setupvalue to pass t?
 searchfunc()
end

如何使用 debug.setupvalue 传递 t?

function dosearch(t)
   t:search()
end

相当于

dosearch = load [[
  local t = ...
  t:search()
]]