lua-users home
lua-l archive

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


I would like to make calls to io.stderr:write() be silent sometimes but I am unable to redefine that function temporarily.   Below is a tiny example of what I tried.  This doesn't work.  What does?
-------------------------------------------------------------

local function nothing()
end

io.stderr:write("hello world!\n")

-- Trying to make io.stderr:write() be silent
local my_write = write
write = nothing
io.stderr:write("hello world yet again!\n")

-- Trying to make io.stderr:write() to work again
write = my_write
io.stderr:write("hello world yet again and again!\n")


--
Robert McLay, Ph.D.
Manager of Software Tools, HPC