Garry's Mod Wiki

string.GetExtensionFromFilename

  string string.GetExtensionFromFilename( string path )

Description

Returns extension of the file.

Arguments

1 string path
The string eg. file-path to get the file extension from.

Returns

1 string
File extension or nil.

Example

Prints the extension of the file.

print(string.GetExtensionFromFilename("garrysmod/lua/modules/string.lua"))
Output: lua