Garry's Mod Wiki

string.char

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 table we start with for i = 1, length do result[i] = string.char( math.random(32, 126) ) end return table.concat(result) end print( string.Random( 10 ) )
Output:
oEjkv2?h:T

Special Pages


Wikis

?

Render Time: 72ms

DB GetPage 52
Generate Html 4
SaveChanges (1) 6
Render Body 0
Render Sidebar 7