From e1c7c4772a8c1c651964bbcfbcdc0dc5d47d6dc4 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Mon, 25 Jun 2012 00:39:23 +0200 Subject: os: change os.getenv init to allow standalone usage of os widget Test case: lua> foo = require("vicious.widgets.os") lua> print(foo()[1]) /usr/share/lua/5.1/vicious/widgets/os.lua:66: attempt to call field 'getenv' (a nil value) --- widgets/os.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'widgets') diff --git a/widgets/os.lua b/widgets/os.lua index 288fcd4..52180e3 100644 --- a/widgets/os.lua +++ b/widgets/os.lua @@ -7,8 +7,8 @@ local pairs = pairs local tonumber = tonumber local io = { popen = io.popen } -local os = { getenv = os.getenv } local math = { ceil = math.ceil } +local los = { getenv = os.getenv } local setmetatable = setmetatable local helpers = require("vicious.helpers") local string = { @@ -63,7 +63,7 @@ local function worker(format) end -- Get user from the environment - system["username"] = os.getenv("USER") + system["username"] = los.getenv("USER") return {system["ostype"], system["osrelease"], system["username"], system["hostname"], system["entropy"], system["entropy_p"]} -- cgit v1.2.3