GE Lua Documentation

Press F to search!

randomASCIIString

Definition


-- @/lua/ge/ge_utils.lua:1502

function randomASCIIString(len)
  if not __randomWasSeeded then
    math.randomseed(os.time())
    __randomWasSeeded = true
  end
  local res = ''
  local ascii = '01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
  local sl = string.len(ascii)
  for i = 1, len do
    local k = math.random(1, sl)
    res = res .. string.sub(ascii, k, k)
  end
  return res
end

Callers

@/lua/ge/extensions/core/chat.lua

local wishedNickName = 'ingame_' .. randomASCIIString(6)
@/lua/ge/extensions/editor/shapeEditor.lua
  if not highlightMaterial then
    highlightMaterialName = "tmp_spHighlight_"..randomASCIIString(8)
    highlightMaterial = createObject('Material')