GE Lua Documentation

Press F to search!

fullValueString

Definition


-- @/lua/common/extensions/ui/flowgraph/editor.lua:238

local function fullValueString(value, tpe)
  if value == nil then
    return ("nil")
  end
  if tpe == nil or type(tpe) == 'table' or tpe == 'any' then
    -- guess type
    if type(value) == 'boolean' or type(value) == 'string' or type(value) == 'number' then
      tpe = type(value)
    elseif type(value) == 'table' then
      if #value == 3 then
        tpe = 'vec3'
      elseif #value == 4 then
        tpe = 'quat'
      end
    else
      tpe = 'string' -- treat as generic usin "tostring"
    end
  end

  if tpe == 'flow' then
    return (value and "Flowing" or "Not Flowing")
  elseif tpe == 'string' or tpe == 'bool' then
    return (tostring(value))
  elseif tpe == 'number' then
    return (string.format("%f", value))
  elseif tpe == 'vec3' then
    return (string.format("{%f, %f, %f}", value[1], value[2], value[3]))
  elseif tpe == 'quat' then
    return (string.format("{%f, %f, %f, %f}", value[1], value[2], value[3], value[4]))
  elseif tpe == 'color' then
    return (string.format("{%f, %f, %f, %f}", value[1], value[2], value[3], value[4]))
  end
  return "???"
end

Callers

@/lua/ge/extensions/flowgraph/pin.lua
    --im.Text("HC Type = " .. tostring(self.hardCodeType))
    --im.Text(ui_flowgraph_editor.fullValueString(val, self.hardCodeType and self.hardCodeType or self.type))
    --im.TextUnformatted('PIN ID: ' .. tostring(self.id))
@/lua/common/extensions/ui/flowgraph/editor.lua
  end
  im.Text(M.fullValueString(value, tpe))
end