message_target(3)
π message_target(3) β a.k.a. the "send a lil text note to a frameserver" era π
okay so real talk, this is a page out of the Library Functions Manual and it's all about message_target, which sends a utf-8 coded text message to a frameserver. yes bestie, that's the whole NAME section, we're starting strong β¨
πΈ SYNOPSIS πΈ
int:bytes_left
message_target( vid:tgtvid, string:msg )
so it gives you back an int:bytes_left, and it takes a vid:tgtvid plus a string:msg. that's the whole vibe check π«Ά
π¦ DESCRIPTION π¦
okay so picture this: rare occasions. we're talking custom applications, and clipboard situations that are not using the bchunk-method of transfer. in those specific cases it genuinely makes sense to send short custom text messages to a target frameserver π
so what this function does is: it takes a string, validates it as utf-8, breaks it down into event-sized chunks, and adds them to the target frameserver's incoming eventqueue. iconic behavior, no notes π
and the return value? lemme break it down because it's giving three-whole-personalities:
0β slay, the entire message was sent, we love a clean finish π- a negative value β the string failed to validate, so like... it did not pass the vibe check π
- a positive number β this one tells you the number of bytes left π and heads up, this case only occurs if the target event queue is full, so it's not a random thing, it's specifically the queue-is-full situation
β¨ NOTES β¨
- in cases where an arcan appl was spawned by another arcan instance,
WORLDIDis a valid vid formessage_targetto the parent. and you can test this:
-- via ref:valid_vid(WORLDID, TYPE_FRAMESERVER).
literally that's the test, iykyk π§
π EXAMPLE π
here's the whole thing, bestie, copy it exactly:
-- @group: targetcontrol
-- @cfunction: targetmessage
-- @related: target_input
function message_target0()
target_alloc("test", function(source, status)
if (status.kind == "connected") then
message_target(source, "welcome");
return shutdown();
end
end);
end
the way this just allocates a target, waits for status.kind == "connected", fires off "welcome" into the world, and then immediately shutdown()s β main character energy, honestly π₯
and that's the whole page, no cap. every flag-free, option-free, detail-preserved bit of it π (yes there are no OPTIONS here, don't come for me, that's just the page π)
mwah π this lil drop comes to you courtesy of the Arcan Lua API and is dated October 2026 β take care of her, she's iconic πβπ
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms