Created
June 25, 2014 19:52
-
-
Save h1k3r/089d43771bdf811eefe8 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 |
does this still work?
thank you :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks