It is currently April 16th, 2024, 7:14 pm

io.popen is nil on Windows 10?

Discuss the use of Lua in Script measures.
jorm
Posts: 3
Joined: November 16th, 2022, 4:07 pm

io.popen is nil on Windows 10?

Post by jorm »

Nevermind; I found https://forum.rainmeter.net/viewtopic.php?p=153631&hilit=io.popen#p153595
I'm leaving the question for reference.

I'm trying to use io.popen to ping a host.
The line is:

Code: Select all

local p = io.popen('ping -n 1 -w 1 ' .. addr_lan)
with addr_lan being an ip address, of course.
The error messag in the log is:

Code: Select all

Script: Ping2Hosts.lua:21: attempt to call field 'popen' (a nil value)
As far as I read, io.popen should be defined under Windows 10. Could that be a missing library or binding?

(I used os.execute before, but that flashed a command window every time, which was annoying.)

Any other way to get a ping result, without flashing windows?
Thanks in advance.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2602
Joined: March 23rd, 2015, 5:26 pm

Re: io.popen is nil on Windows 10?

Post by SilverAzide »

This is documented in the Rainmeter manual: https://docs.rainmeter.net/manual/lua-scripting/#Restrictions
Gadgets Wiki GitHub More Gadgets...