define_arcantarget(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

πŸ’… define_arcantarget(3) β€” the Arcan Lua API one, bestie

okay so this is define_arcantarget from the Arcan Lua API manual, third section, and it is genuinely the moment your secondary outputs get their whole life together. let's get into it πŸŽ€


✨ NAME ✨

define_arcantarget β€” create a rendertarget bound subsegment for drawing to another arcan instance. that's the whole vibe. one target, another instance, slay. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

bool
define_arcantarget( vid:vstore, string:type, vidtbl:vpipe,
function:handler )

like, look at that signature. it's giving structured. bool coming back at you, and three args plus a handler doing the work. no cap. ⭐


🌸 DESCRIPTION 🌸

so what this function actually does: you use it to request and bind 'subsegments' that are useful for secondary outputs. that's the job. that's the assignment, and it ate. πŸ’…

also important β€” the event model is also applied for target_updatehandler when applied to WORLDID. iykyk. don't sleep on that part. πŸ‘‘

it works like any other normal rendertarget, like one you'd allocate through define_rendertarget, periodt β€” but the clocking and the updates are explicitly tied to what the arcan instance the segment is connected to decides. so like, you're not the main character of the timing here, the instance you're attached to is. respect the hierarchy bestie. 🫢

⚠️ real talk: the design and inner workings for this function are marked as experimental and may be subject to incremental changes. so if it acts a little different next month, that's not you, that's the API being a work in progress. 😭

πŸŽ€ NOTES πŸŽ€

  1. valid types are: 'cursor', 'popup', 'icon', 'clipboard', 'titlebar'. that's the list, memorize it, there is no bonus round. ✨
  2. an invalid vstore or an unsupported type is a terminal state transition. read that again. it's not a warning, it's not a soft fail, it's terminal. πŸ’€

πŸ”₯ EXAMPLE πŸ”₯

function define_arcantarget0()
      local ok =
            define_arcantarget(buffer, "media", {test},
            function(source, status)
                  if status.kind == "terminated" then
                        delete_image(source)
                  end
                  print(status.kind)
            end
      )
      if not ok then
            delete_image(buffer)
      end
end
end

see how it grabs the ok bool, and if it's not ok you delete_image(buffer) and move on with your life? that's the self-care. 🌈 (and yes, the end situation at the bottom is exactly as it appears β€” we don't fix, we don't merge, we don't judge. 🫢)


πŸ‘‘ SEE ALSO πŸ‘‘

targetcontrol β€” go read that one next, bestie, it's the natural next tab in your browser. πŸ¦‹


okay that's the whole page!! go forth and bind your subsegments, you absolute icon πŸ’–βœ¨

sign-off time πŸŽ€ β€” this little beauty lives in the Arcan Lua API and is dated October 2026 in the define_arcantarget(3) section, so if you're quoting it in the group chat, cite it properly, mwah πŸ’…

πŸ“¦ where this page comes from