pick_items(3)
π 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 π¦
- 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 theMASK_UNPICKABLEmask (seeimage_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 howlink_imageis being used. No shortcuts, no assumptions. π - 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." π
- 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. ππ₯
- 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. π
- And this one's important β if an object is shader displayed, or manually manipulated by skewing vertices through
image_tesselationor 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: π
image_hit(3)β your other picking bestie β¨
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
- 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