GE Lua Documentation

Press F to search!

concatWorkBuffer

Definition


-- @/lua/common/utils.lua:545

function concatWorkBuffer(...)
  cBufTmp:reset()
  for i = 1, select('#', ...) do
    local v = select(i, ...)
    local vtype = type(v)
    if vtype == 'number' then
      cBufTmp:put(v * 0 == 0 and v or (v > 0 and '9e999' or '-9e999')) -- inf,nan
    elseif vtype == 'table' then  --tables
      for k, v1 in ipairs(v) do
        local vtype1 = type(v1)
        if vtype1 == 'number' then
          cBufTmp:put(v1 * 0 == 0 and v1 or (v1 > 0 and '9e999' or '-9e999')) -- inf,nan
        else
          cBufTmp:put(vtype == 'boolean' and tostring(v) or v)
        end
      end
    elseif vtype == 'nil' then
      return cBufTmp
    else
      cBufTmp:put(vtype == 'boolean' and tostring(v) or v)
    end
  end
  return cBufTmp
end

Callers

@/lua/common/guihooks.lua
local function triggerRawJS(hookName, rawJs)
  queueHookJS(hookName, concatWorkBuffer('[', tostring(rawJs), ']'))
end