string.format
Replaces placeholder strings in a string with the specified arguments.
|
|||
Replace %s with what the user enters. |
|||
Code | <nowiki>
local name = read()
print(string.format("Hello, %s!", name))
</nowiki>
|
||
Output | Prints "Hello," and whatever the user entered. |
|
|||
Replace %s with what the user enters. |
|||
Code | <nowiki>
local name = read()
local output = "Hello, %s!"
print(output:format(name))
</nowiki>
|
||
Output | Prints "Hello," and whatever the user entered. |
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lua |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CC:Tweaked |
|
string.format Function | |
---|---|
Syntax string.format(
| |
Returns | string output |
API | string |
Source | Lua |
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.