【问题标题】:Howto detect that a Lua script is running on CORE?如何检测 Lua 脚本正在 CORE 上运行?
【发布时间】:2021-08-19 11:11:33
【问题描述】:

我想编码

if (???) then
-- Code which is intended to run specially on CORE ( e.g. special references to CORE objects )
else
-- Code which is not intended to run on CORE ( e.g. the standard "require()",..)
end

如何做到这一点? 我猜我可能会用“os”库函数来做,但我没有得到任何线索。

真诚的 罗尔夫

【问题讨论】:

    标签: lua operating-system game-engine lua-api coregames


    【解决方案1】:

    一些 Lua 的标准函数已在 Core 中删除。

    因此,例如,如果您可以访问 io 库,那么您就不会从 Core 中运行您的脚本。

    if not io then
      print("not running standard Lua")
    end
    

    或者找到只存在于 Core 中的东西。

    if CoreObject then
      print("we're likely running Core")
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-19
      • 2019-04-01
      • 2012-07-11
      • 2018-06-04
      • 1970-01-01
      • 1970-01-01
      • 2019-01-17
      • 2016-03-29
      相关资源
      最近更新 更多