Garry's Mod Wiki

Revision Difference

Global.UpdateMapList#548512

<function name="UpdateMapList" parent="Global" type="libraryfunc">⤶ <description>⤶ <internal>Called from JS when starting a new game</internal>⤶ This function updates the Map List⤶ </description>⤶ <realm>Menu</realm>⤶ <file line="239-L251">lua/menu/getmaps.lua</file>⤶ </function>⤶ ⤶ <example>⤶ <description>Manually updating the Map List with one Category.</description>⤶ <code>⤶ --⤶ local mapList = {⤶ ["Example"] = {"gm_flatgrass", "gm_construct"}⤶ }⤶ ⤶ pnlMainMenu:Call( "UpdateMaps(" .. util.TableToJSON(mapList) .. ")" )⤶ </code>⤶ <output>⤶ <image src="https://i.imgur.com/kuGQXox.png"/>⤶ </output>⤶ </example>⤶ ⤶ <example>⤶ <description>Manually updating the Map List with an extra Category.</description>⤶ <code>⤶ --⤶ local mapList = GetMapList()⤶ mapList["Example"] = {"gm_flatgrass", "gm_construct"}⤶ ⤶ pnlMainMenu:Call( "UpdateMaps(" .. util.TableToJSON(mapList) .. ")" )⤶ </code>⤶ <output>⤶ <image src="https://i.imgur.com/1zJbb2l.png"/>⤶ </output>⤶ </example>