lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I was looking for a way to get the OS name and architecture in pure lua, without depending on other modules. I could not find anything satisfactory so I just put up a small project on GitHub to do that. I am posting here for feedback and in case it might be useful to somebody else.

On Windows, the program will use environment variables. On linux-like OS, it will use uname with popen.

Example on Windows:

c:> lua test_get_os_name.lua
os="Windows" arch="x86"

Example on MacOs X:

$ lua test_get_os_name.lua
os="Mac" arch="x86_64"

Example on Linux:

$ lua test_get_os_name.lua
os="Linux" arch="x86_64"

It is heavily based on the following Gist: https://gist.github.com/soulik/82e9d02a818ce12498d1

The project page : https://github.com/bluebird75/lua_get_os_name

What would be really nice is to fetch the actual windows version. If you have some ideas....

Cheers,

Philippe