开发者

Get the required module names for Lua

开发者 https://www.devze.com 2023-02-28 19:49 出处:网络
Is there a way to ch开发者_开发百科eck what modules is required by a lua script after I loaded it?More of a hack than a real solution: if you control the hosting environment, you can always replace re

Is there a way to ch开发者_开发百科eck what modules is required by a lua script after I loaded it?


More of a hack than a real solution: if you control the hosting environment, you can always replace require with your version of it:

local require_original = require

function require(module)
    -- do something with the module name
    require_original(module)
end


Check out package.loaded table.

0

精彩评论

暂无评论...
验证码 换一张
取 消