Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Lua - get hostname
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
@huwenbiao
Copy link

huwenbiao commented Dec 29, 2020

thanks

@erikLundstedt
Copy link

erikLundstedt commented Dec 12, 2021

does this still work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment