How can I determine the OS of the system from within a Lua script?

前端 未结 5 1310
离开以前
离开以前 2021-02-12 12:36

Ok I need to determine the system\'s OS from a Lua script, but Lua as such has no API for this, so I use os.getenv() and query enviromental variables. On Windows checking the en

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-12 13:23

    You can try package.config:sub(1,1). It returns the path separator, which is '\\' on Windows and '/' on Unixes...

提交回复
热议问题