如何获取表的名称而不打印表:0xwhatever元素?

我正在制作一个记录函数(暂时)并计划使代码更易于阅读的东西。为了完全实现它,我需要显示表名而不显示表的元素。

export={}--用于导出数据
functiontable={}--用于导出原始函数(运行的代码)
--函数替换
oldprint=print
functionlog(funcname,funccontent,rawfunction)
    e=# export + 1
    oldprint(funcname ..“”.. funccontent ..“”..“ export”..“ [”.. e ..“]”) - 自动打印输入
    export [e] = funcname ..“”.. tostring(funccontent)..“”.. “导出”..“ [”.. e ..“]”-将数据保存在表中
    functiontable[#functiontable+1] = rawfunction
end
functionprint(content)
    如果内容为零则
        内容=“没有输入”
    end
    oldprint(content)
    funccontent = content
    如果type(funccontent)==“string”则
        funccontent =“”.. funccontent ..“”
    end
    log(“打印”,content,“打印”..“(”.. funccontent ..“)”)
end

这是我的代码,基本上它会接受运行的函数并简化它们,并显示使用什么参数运行的函数 例如

'打印(“嗨”)' 看起来像这样

打印嗨出口[1]

(功能、参数、日志记录位置)

对于原始函数,我想要它显示

'打印(“嗨”)' 直到我尝试使用表

关于数据

如果我要做 打印(export [1]),它会打印

print hi export[1]

这就是我想要的,但我有的问题是它说它是这样的 'print(“打印嗨导出[1]”)' 实际代码为 'print(export [1])'

我不知道如何解决这个问题,我还想添加表格日志记录但对于这个它会打印那个奇怪的0x东西,我想要的示例输出是

表格表名出口[whatever]

我得到的是

表0xsomething打印[whatever]

点赞