Err... Why are you making Lua print the selection in the chat ?... Do you really need this, or did just you copy and paste the
example code (which is just a way to demonstrate how the callback works but got no practical purpose) for
OnLuaFloaterAction() in the Lua manual ?
The
OnLuaFloaterAction() callback is not even necessary, if you do not need to perform complex tasks on UI elements commit, and can instead do it all with
SetLuaFloaterCommand(). You can also filter on UI floater or UI element name in the callback to exit it sooner (and avoid watchdog timeouts) for things you do not care about (e.g. with
if control == "inventory1" then return end inserted at the start of the callback, if you do not need to take specific action on inventory items selection but just use the inventory UI element for its own context menu actions).
The problem, here, is that the callback will be called for each matching inventory item, so the printing in the chat for each callback will indeed slow down the viewer, and at some point, the Lua watchdog will trigger to prevent an excessive slow down.
If you do need the
OnLuaFloaterAction() callback and do not want to see it called too frequently while filtering, you may also start the said filtering only after a significative enough number of characters have been typed in the search input line (meaning there will be much less matching items and much less callbacks): e.g.
SetLuaFloaterCommand('inventoryOU','searchedit1','if #GetValue() > 2 then SetLuaFloaterInvFilter(GetFloaterName(),[[inventory1]],GetValue()) end') to set the filter only after the match string contains 3 or more characters (if #GetValue() > 2).
EDIT: in addition, for next release, and to avoid callback storms, I changed the inventory panel Lua callback logic to ignore callbacks not resulting from a user action (mouse button or keyboard key click).