pick_items(3)

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

πŸ’… pick_items(3) β€” Arcan Lua API, bestie edition ✨

Okay so before we even get into it: this page lives in the Arcan Lua API manual, and it's about pick_items, which is the lowkey MVP of "what did the user just click on" energy. Let's go 🫢


🌸 NAME 🌸

pick_items β€” pick a number of objects based on a screen-space coordinate. That's it. That's the whole vibe. 🎯


✨ SYNOPSIS ✨

vidtbl:results
pick_items( number:x, number:y )
pick_items( number:x, number:y, number:limit=8 )
pick_items( number:x, number:y, number:limit=8 )
pick_items( number:x, number:y, number:limit=8<=64, bool:reverse=false )
pick_items( number:x, number:y, number:limit=8<=64, bool:reverse=false, vid:rtgt=WORLDID )

Yes bestie, that third line is literally the same as the second one. That's how it is in the manual. We don't argue with the manual, we just vibe with it. πŸ’€


πŸ’– DESCRIPTION πŸ’–

So pick_items is a low level function β€” like, foundation-level, not here to hold your hand β€” for building user-interface related picking tools. πŸ”¨

It takes a screen-space or rendertarget-space coordinate, and it sweeps through the pipeline based on their render order (peep order_image for the deets on that one πŸ‘€).

If reverse is provided, it sweeps from high to low. Otherwise it goes low to high. Simple as.

And the way it's so efficient? It early outs once limit objects have been found. Iconic behavior honestly. ⚑

It will always return an integer indexed table of zero to limit number of VIDs. And limit is not allowed to exceed 64 β€” that's a hard no, not a suggestion. 🚫


πŸ¦‹ NOTES πŸ¦‹

  1. All VIDs start out as eligible for picking ✨ β€” that's the default, everyone's invited to the party. But you can control it by setting the MASK_UNPICKABLE mask (see image_mask_set). And here's the catch, bestie: this mask value is not inherited by default through linking. Which literally means you gotta set it for each new object, regardless of how link_image is being used. No shortcuts, no assumptions. πŸ™ˆ
  2. Clipping and alpha channel are ignored 😭 β€” like, fully not considered at all. You're gonna have to handle that manually by testing against any possible clipping parents. It's giving "do it yourself, girl." πŸ’…
  3. This function can be very costly depending on the complexity of the scene, so if you're expecting a high number of calls β€” for instance when it's tied to a touch or mouse-input device event handler β€” you really should be using some caching mechanism. Do not come crying to me when your frame rate dips, I warned you. 😭πŸ”₯
  4. The cost progression goes roughly (low to high): normal β†’ rotated β†’ linked β†’ 3d object β†’ rotated-linked β†’ rotated-linked-3d object. So like, the more you stack, the more expensive it gets. Plan accordingly boo. πŸ“ˆ
  5. And this one's important β€” if an object is shader displayed, or manually manipulated by skewing vertices through image_tesselation or a vertex stage shader, the picking operation result is undefined. Undefined! Not "a little off", not "close enough" β€” undefined. You have been warned. πŸ’€βš οΈ

πŸ‘‘ SEE ALSO: πŸ‘‘


Mwah πŸ’‹ that's the whole page, no crumbs left. This one's from the image manual, dated October 2026 β€” go forth and pick responsibly, bestie πŸŽ€πŸ’œπŸŒˆβ­

πŸ“¦ where this page comes from