-
-
Save dedayoa/d0941cfb2dad72550250899d075893f0 to your computer and use it in GitHub Desktop.
Lua - get hostname
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local _M = {} | |
function _M.getHostname() | |
local f = io.popen ("/bin/hostname") | |
local hostname = f:read("*a") or "" | |
f:close() | |
hostname =string.gsub(hostname, "\n$", "") | |
return hostname | |
end | |
return _M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment