Garry's Mod Wiki

Revision Difference

search.AddProvider#512790

<function name="AddProvider" parent="search" type="libraryfunc">⤶ <description>Adds a search result provider. For examples, see gamemodes/sandbox/gamemode/cl_search_models.lua</description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="provider" type="function">Provider function. It has one argument: {{FuncArg|string|searchQuery</arg>⤶ <arg name="id" type="string" default="nil">If provided, ensures that only one provider exists with the given ID at a time.</arg>⤶ </args>⤶ </function>⤶ ⤶ You must return a list of tables structured like this:⤶ * <page>string</page> text - Text to "Copy to clipboard"⤶ * <page>function</page> func - Function to use/spawn the item⤶ * <page>Panel</page> icon - A panel to add to spawnmenu⤶ * <page>table</page> words - A table of words?⤶ }}