utf8.insert | Multi Theft Auto: Wiki Skip to content

utf8.insert

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


Inserts a substring into input string. If insert-position is given, the substring will be inserted before the character at this index, otherwise the substring will concatenate to input. The insert position may be negative.

Syntax

utf8.insert ( )

Code Examples

server

This example shows a command handler for '/insert [something]', which will concatenate the '[something]' after the 'hello ' string in 2 ways.

addCommandHandler("insert",
function (player, command, word)
if word then
local output = utf8.insert( "hello ", word )
outputChatBox( output, player )
local output = utf8.insert( "hello ", utf8.len( "hello " ) + 1, word )
outputChatBox( output, player )
end
end
)

See Also