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

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.
Post Reply
mickro
Prole
Posts: 2
Joined: Mon May 26, 2014 12:26 pm

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

Post 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 ?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post by bartbes »

You're using a dot instead of a colon, that's the problem.
User avatar
zorfmorf
Prole
Posts: 33
Joined: Sat Mar 10, 2012 12:31 pm

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

Post by zorfmorf »

It's channel:push instead of channel.push ;)

Edit: Seems like I was too late
mickro
Prole
Posts: 2
Joined: Mon May 26, 2014 12:26 pm

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

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests