我目前正在使用Windows
在我的默认开发系统上和Linux
在我部署 Lua 脚本的服务器上。为了Windows
只有几个 32 位解释器,例如Windows 下的 Lua https://github.com/rjpcomputing/luaforwindows我目前使用的一个(至少据我所知)。在服务器上,解释器在 64 位上运行脚本。
现在我的问题是:是否可以检查脚本正在运行的架构(可能类似于_ENV
版本变量)?
如果有任何 64 位 Windows Lua 解释器,请随时对此事发表评论。先感谢您。
这是如何确定您的操作系统位数,而不是您的编译器位数(您可以在 Windows 64 位上运行 32 位 Lua.exe)。
local arch
if (os.getenv"os" or ""):match"^Windows" then
print"Your system is Windows"
arch = os.getenv"PROCESSOR_ARCHITECTURE"
else
print"Your system is Linux"
arch = io.popen"uname -m":read"*a"
end
if (arch or ""):match"64" then
print"Your system is 64-bit"
else
print"Your system is 32-bit"
end
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)