target_parent(3)

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

✨ target_parent(3) ✨

okay so bestie, welcome to the Arcan Lua API page for target_parent β€” she's short, she's sweet, she's giving "small function, big job" energy πŸ’… and you're gonna get it in like two minutes flat, no cap.


πŸŽ€ NAME πŸŽ€

target_parent β€” look up the frameserver VID of the parent of a subsegment. yes she's basically a "who's your mom" lookup for vids πŸ‘‘


🌸 SYNOPSIS 🌸

vid
target_parent( vid )

that's the whole vibe: you hand her a vid, she hands you back a vid. simple. iconic. πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

so this function is your little detective πŸ” β€” you give her a specific vid and she figures out if that vid is a subsegment of a frameserver. if it is, she gives you the primary vid associated with that frameserver. literally that's it, that's the whole function, and honestly? she ate.


⭐ NOTES ⭐

  1. ok so fair warning bestie πŸ™ˆ β€” it is not guaranteed that the returned vid points to a valid frameserver or vid if the connection has been pacified</> or terminated externally</>. so like, don't just trust it blindly if things got weird, mmkay? πŸ’€

🧚 EXAMPLE 🧚

function target_parent0()
      local a = target_alloc("test", function() end);
      b = target_alloc(a, function() end);
      if (target_parent(b) != a) then
            shutdown("reported subsegment parent is invalid", -1);
      else
            shutdown("");
      end
end

so here we allocate a, then allocate b as a subsegment of a, and then check β€” does target_parent(b) actually equal a? if not, we bail out with "reported subsegment parent is invalid" and -1. if it matches, we shutdown("") and vibe 🌈


πŸ“ EXAMPLE πŸ“

function target_parent1()
      local a = target_alloc("test", function() end);
      if (valid_vid(target_parent(a))) then
            shutdown("connection point should not have a parent", -1);
      else
            shutdown("");
      end
end

and this one is the ✨reverse test✨ β€” a here is a top-level connection point, so target_parent(a) should not be a valid vid. if valid_vid says it is, that's a problem and we shutdown("connection point should not have a parent", -1). otherwise, clean exit, no drama πŸ’œ


πŸ”₯ SEE ALSO πŸ”₯

  • targetcontrol

okay that's the whole page bestie, you're officially a target_parent expert 🫢 β€” this gem is from the Arcan Lua API, dated October 2026</>, and yes she's still filed under target_parent(3) in case you need to find her again πŸ’«

πŸ“¦ where this page comes from