Difference between revisions of "love.thread.getChannel (Français)"
(traduction de en:) |
(→Communication entre main/thread) |
||
Line 13: | Line 13: | ||
=== Communication entre main/thread === | === Communication entre main/thread === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | -- main (principal) | + | -- main (programme principal) |
thread = love.thread.newThread ( "thread.lua" ); | thread = love.thread.newThread ( "thread.lua" ); | ||
thread:start (); | thread:start (); |
Revision as of 16:00, 27 December 2020
Available since LÖVE 0.9.0 |
This function is not supported in earlier versions. |
Crée et récupère un channel (canal) de thread (fil d'exécution) nommé.
Contents
Fonction
Synopsis
channel = love.thread.getChannel( name )
Arguments
string name
- Le nom du channel que vous désirez créer ou récupérer.
Retours
Channel channel
- L'objet channel associé au nom.
Exemples
Communication entre main/thread
-- main (programme principal)
thread = love.thread.newThread ( "thread.lua" );
thread:start ();
channel = {};
channel.a = love.thread.getChannel ( "a" );
channel.b = love.thread.getChannel ( "b" );
channel.b:push ( "foo" );
function love.update ( dt )
local v = channel.a:pop ();
if v then
print ( tostring ( v ) );
channel.b:push ( "foo" );
end
end
-- thread
channel = {};
channel.a = love.thread.getChannel ( "a" );
channel.b = love.thread.getChannel ( "b" );
while true do
local v = channel.b:pop ();
if v then
print ( tostring ( v ) );
channel.a:push ( "bar" );
end
end
Voir également
Autres langues
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info