Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help,
read this.
-
kalle2990
- Party member
- Posts: 245
- Joined: Sat Sep 12, 2009 1:17 pm
- Location: Sweden
Post
by kalle2990 » Thu May 26, 2011 3:59 pm
Okay, I have tested the new version on Ubuntu now and it seems to be working just fine. It features detection of Linux desktops without gnome and Macs, and opening of files for them
Please tell me how it runs on OSX

-
Attachments
-
File Explorer.love
- Version 1.2
- (1.32 KiB) Downloaded 60 times
-
BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
-
Contact:
Post
by BlackBulletIV » Thu May 26, 2011 9:21 pm
popen isn't supported for me it seems. How about using os.execute with output redirection, like this:
Code: Select all
local file = os.tmpname()
os.execute('uname -s > ' .. file)
local f = io.open(file)
local os = f:read('*a')
f:close()
I haven't tested it, nor did I look at the manual, but I think that's correct.
Man I find Lua's lack of functionality annoying.
-
TsT
- Party member
- Posts: 161
- Joined: Thu Sep 25, 2008 7:04 pm
- Location: France
-
Contact:
Post
by TsT » Fri May 27, 2011 9:58 am
Or use io.popen() instead of os.execute()
Code: Select all
local f = io.popen("pwd") -- runs command
local l = f:read("*a") -- read output of command
print(l)
f:close()
Code: Select all
function execute(cmd)
local f = io.popen(cmd)
local str = f:read("*a")
return str
end
function str2tbl(str, sep)
sep = sep or "\n"
local t = {}
for line in string.gmatch(str, "[^\n]+") do
table.insert(t, line)
end
return t
end
table.foreach(str2tbl(execute("uname -s")), print)
-
thelinx
- The Strongest
- Posts: 848
- Joined: Fri Sep 26, 2008 3:56 pm
- Location: Sweden
Post
by thelinx » Fri May 27, 2011 10:00 am
BlackBulletIV wrote:popen isn't supported for me it seems.
-
slime
- Solid Snayke
- Posts: 2923
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
-
Contact:
Post
by slime » Fri May 27, 2011 3:37 pm
io.popen works fine using a regular Lua install but says it's not supported when I run it through LÖVE, oddly enough (OSX).
-
bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
-
Contact:
Post
by bartbes » Sat May 28, 2011 10:44 am
It is non-portable, and it seems most love distributed lua builds don't support it.
Users browsing this forum: No registered users and 49 guests