Garry's Mod Wiki

string.Left

  string string.Left( string str, number num )

Description

Returns everything left of supplied place of that string.

Arguments

1 string str
The string to extract from.
2 number num
Amount of chars relative to the beginning (starting from 1).

Returns

1 string
Returns a string containing a specified number of characters from the left side of a string.

Example

Extracts "garry" from "garrys mod" string.

local text = "garrys mod" print(string.Left(text, 5))
Output: garry