Garry's Mod Wiki

Revision Difference

util.RelativePathToGMA_Menu#549129

<function name="RelativePathToGMA_Menu" parent="util" type="libraryfunc">⤶ <description>⤶ Returns the AddonInfo of the Addon the given file belongs to.⤶ </description>⤶ <realm>Menu</realm>⤶ <args>⤶ <arg name="gma" type="string">The **Full** path to the GMA file. **like: "[Steam folder]\common\garrysmod\garrysmod\addons\[Name].gma"**</arg>⤶ </args>⤶ <rets>⤶ <ret name="addoninfo" type="table">The AddonInfo of the GMA file. Will return nil if the File doesn't belongs to an addon. Table Structure:⤶ ```lua⤶ Author = [Addon Author]⤶ File = [Steam folder]\workshop\content\4000\[Addon ID]/[GMA Name].gma⤶ ID = [Addon ID]⤶ Title = [Addon Title]⤶ ```⤶ </ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Prints the AddonInfo of the given Path (The Addon the file belongs to.)</description>⤶ <code>⤶ PrintTable( util.RelativePathToGMA_Menu( "[Insert here something from an addon like a Model]" ) ) -- prints the AddonInfo⤶ </code>⤶ <output>⤶ ```lua⤶ Author = [Addon Author]⤶ File = [Steam folder]\workshop\content\4000\[Addon ID]/[GMA Name].gma⤶ ID = [Addon ID]⤶ Title = [Addon Title]⤶ ```⤶ </output>⤶ </example>