Garry's Mod Wiki

Garry's Mod Wiki

  string string.char( ... )

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

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...