Garry's Mod Wiki

Revision Difference

search.AddProvider#516989

<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="provider" type="function">Provider function. It has one argument: &lt;page&gt;string&lt;/page&gt; searchQuery&#xA;You must return a list of tables structured like this:&#xA;* &lt;page&gt;string&lt;/page&gt; text - Text to &quot;Copy to clipboard&quot;&#xA;* &lt;page&gt;function&lt;/page&gt; func - Function to use/spawn the item&#xA;* &lt;page&gt;Panel&lt;/page&gt; icon - A panel to add to spawnmenu&#xA;* &lt;page&gt;table&lt;/page&gt; words - A table of words?</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?⤶ }}