Garry's Mod Wiki

Revision Difference

steamworks.DownloadUGC#529709

<function name="DownloadUGC" parent="steamworks" type="libraryfunc"> <description>Downloads a Steam Workshop file by its ID and returns a path to it.</description> <realm>Client and Menu</realm> <args> <arg name="workshopID" type="string">The ID of workshop item to download. **NOT** a file ID.</arg> <arg name="resultCallback" type="function">The function to process retrieved data. The first argument is a string, containing path to the saved file, or nil if the download failed to any reason. The second argument is a <page>File</page> object pointing to the downloaded .gma file. The file handle will be closed after the function exits.</arg> </args> </function> <example> <description>Downloads the Fire Extinguisher addon from Steam Workshop prints path to its .gma file to be used with <page>game.MountGMA</page>.</description> <code> steamworks.DownloadUGC( "104607228", function( name, file ) print( name, file ) steamworks.DownloadUGC( "104607228", function( path, file ) print( path, file ) end) </code> </example>