在 Premake 中使用的 os.rmdir 不能在普通 Lua 中使用。

从 premake cookbook 中,我得到了以下的代码:

solution "MySolution"
  configurations { "Debug", "Release" }

  configuration { "Debug" }
    targetdir "bin/debug"

  configuration { "Release" }
    targetdir "bin/release"

  if _ACTION == "clean" then
    os.rmdir("bin")
  end

我尝试在我的普通 Lua 应用程序中使用 os.rmdir("bin"),将其放入我的 hello1.lua 文件中,并使用以下命令运行它:

lua hello1.lua

但是却发生了错误:

lua: hello1.lua:11: attempt to call field 'rmdir' (a nil value)
stack traceback:
    hello1.lua:11: in main chunk
    [C]: in ?

看起来 os.rmdir 不是标准的 Lua 函数,只是来自于 premake4,我是正确的吗? 在哪里可以找到 os.rmdir 的文档?

点赞
用户2633423
用户2633423

这是关于 os.rmdir 的特定页面,请参见 premake scripting reference

2013-09-05 04:30:13