Page 1 of 1

Migrating 0.8 to 0.9: usage of Channel instead of Thread:set

Posted: Mon May 26, 2014 1:06 pm
by mickro
Hi there !

I'm new with Löve and Lua. I would like to upgrade a 0.8 to 0.91 project I didn't wrote to learn more about.

After few upgrade in old code I'm not good enough to continue conversion. I would like to understand how to.

That is the part of 0.8 code:

Code: Select all

self.stringlist = table.concat(self.toload, ";")
self.thread:set("musiclist", self.stringlist)
which I tried to convert to 0.9

Code: Select all

self.stringlist = table.concat(self.toload, ";")
channel = love.thread.getChannel("musiclist")
channel.push(self.stringlist)
and that is the error message:
bad argument #1 to 'push' (Channel expected, got string)
According to Channel:push
The value of the message can be a boolean, string, number, LÖVE userdata, or a simple flat table. Foreign userdata (Lua's files, LuaSocket, ENet, ...), functions, and tables inside tables are not supported.
Means 'push' don't really expected Channel but boolean, string...

I'm quite lost. Maybe I don't really understand what I'm doing.

Any help around ?

Re: Migrating 0.8 to 0.9: usage of Channel instead of Thread

Posted: Mon May 26, 2014 3:33 pm
by bartbes
You're using a dot instead of a colon, that's the problem.

Re: Migrating 0.8 to 0.9: usage of Channel instead of Thread

Posted: Mon May 26, 2014 3:36 pm
by zorfmorf
It's channel:push instead of channel.push ;)

Edit: Seems like I was too late

Re: Migrating 0.8 to 0.9: usage of Channel instead of Thread

Posted: Mon May 26, 2014 4:05 pm
by mickro
thanks guys!

EDIT: syntax is correct but the behavior does not work. Looks my conversion about thread:set is not correct.

Does someone know can explain thread in Löve 0.8 or Channel in Löve 0.9 ?

EDIT 2:
finally that topic explain enough how that works and problem is solved
http://love2d.org/forums/viewtopic.php?f=4&t=76670