Garry's Mod Wiki

string.char

string string.char( vararg bytes )

Description

Takes the given numerical bytes and converts them to a string.

Arguments

1 vararg bytes
The bytes to create the string from.

Returns

1 string
String built from given bytes

Example

Prints a string consisting of the bytes 72, 101, 108, 108, 111

print( string.char( 72, 101, 108, 108, 111 ) )
Output: Hello

Example

Helper function to create a random string.

function string.Random( length ) local length = tonumber( length ) if length < 1 then return end local result = "" -- The empty string we start with for i = 1, length do result = result .. string.char( math.random(32, 126) ) end return result end print( string.Random( 10 ) )
Output: oEjkv2?h:T

Page Links


Special Pages


Wikis

?

Render Time: 42ms

DB GetPage 7
Generate Html 6
SaveChanges 9
Render Body 0
Render Sidebar 18