string.string.lpad
Declaration
lua
string.lpad(text, length [, pad])
Description
Left-pad string to target length.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
text | string | Required | — | |
length | integer | Required | — | Target length |
pad | string | Optional | " " | Pad character(s) |
Return Values
| Type | Description |
|---|---|
| string | Padded string |
Example
lua
("42"):lpad(5, "0") -- "00042"