Garry's Mod Wiki

Revision Difference

string.GetPathFromFilename#551120

<function name="GetPathFromFilename" parent="string" type="libraryfunc"> <description>Returns the path only from a file's path.</description> <realm>Shared and Menu</realm> <file line="142">lua/includes/extensions/string.lua</file> <file line="152">lua/includes/extensions/string.lua</file> <args> <arg name="Inputstring" type="string">String to get path from.</arg> <arg name="path" type="string">The string eg. file-path to get the path from.</arg> </args> <rets> <ret name="" type="string">Path</ret>⤶ <ret name="" type="string">Path or empty string.</ret>⤶ </rets> </function> <example> <description>Demonstrates the use of string.GetPathFromFilename</description> <code>MsgN(string.GetPathFromFilename("garrysmod/lua/modules/string.lua"))</code> <output>"garrysmod/lua/modules/"</output> </example>