【问题标题】:Is it possible to block functions from compiling by using luajit?是否可以通过使用 luajit 来阻止函数编译?
【发布时间】:2019-01-03 23:30:32
【问题描述】:

所以我现在正在调试我的 lua 脚本,我在这里提出疑问 - 是否可以使用 jit.attach 阻止函数编译? (类似这样)

local function jitcatch(dat)
    local sour = string.sub( jit.util.funcinfo(dat).source, 2 )
    if sour == 'test.lua' then jit.off(dat) end
end
jit.attach( jitcatch, 'bc' )

【问题讨论】:

  • 使用 StackOverflow 的注意事项:如果您在代码的每一行前面放置 4 个空格而不是 `,它将出现在代码块中。然后它将获得语法突出显示并使其更易于阅读
  • 您正试图阻止给定文件test.lua 的所有功能,对吗? jit.off(true, true) 不能满足您的需求吗? luajit.org/ext_jit.html 这样使用 jit.off 可以关闭整个模块的 jit。

标签: lua luajit


【解决方案1】:

jit.off(true, true) 将禁用当前脚本的 jit 编译。 jit.off(function) 将禁用特定函数的 jit 编译。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-15
    • 1970-01-01
    • 2016-12-01
    • 2019-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-07
    相关资源
    最近更新 更多