VE Lua Documentation

Press F to search!

tostring

Definition


-- @/=[C]:-1
function tostring(...)

Callers

@/lua/ge/extensions/editor/tech/roadArchitect/junctions.lua
        profileX1_O.layers[#profileX1_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow X1 F' .. tostring(i)),
          isHidden = false,
        profileX2_O.layers[#profileX2_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow X2 F' .. tostring(i)),
          isHidden = false,
          profileX1_O.layers[#profileX1_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow X1 B' .. tostring(i)),
            isHidden = false,
          profileX2_O.layers[#profileX2_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow X2 B' .. tostring(i)),
            isHidden = false,
          profileY1_O.layers[#profileY1_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow Y1 F' .. tostring(i)),
            isHidden = false,
          profileY2_O.layers[#profileY2_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow Y2 F' .. tostring(i)),
            isHidden = false,
            profileY1_O.layers[#profileY1_O.layers + 1] = {
              name = im.ArrayChar(32, 'Arrow Y1 B' .. tostring(i)),
              isHidden = false,
            profileY2_O.layers[#profileY2_O.layers + 1] = {
              name = im.ArrayChar(32, 'Arrow Y2 B' .. tostring(i)),
              isHidden = false,
        profileX1_O.layers[#profileX1_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow X1 F' .. tostring(i)),
          isHidden = false,
        profileX2_O.layers[#profileX2_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow X2 F' .. tostring(i)),
          isHidden = false,
          profileX1_O.layers[#profileX1_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow X1 B' .. tostring(i)),
            isHidden = false,
          profileX2_O.layers[#profileX2_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow X2 B' .. tostring(i)),
            isHidden = false,
        profileY2_O.layers[#profileY2_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow Y2 F' .. tostring(i)),
          isHidden = false,
          profileY2_O.layers[#profileY2_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow Y2 B' .. tostring(i)),
            isHidden = false,
        profileX1_O.layers[#profileX1_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow X1 F' .. tostring(i)),
          isHidden = false,
        profileX2_O.layers[#profileX2_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow X2 F' .. tostring(i)),
          isHidden = false,
          profileX1_O.layers[#profileX1_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow X1 B' .. tostring(i)),
            isHidden = false,
          profileX2_O.layers[#profileX2_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow X2 B' .. tostring(i)),
            isHidden = false,
        profileY2_O.layers[#profileY2_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow Y2 F' .. tostring(i)),
          isHidden = false,
          profileY2_O.layers[#profileY2_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow Y2 B' .. tostring(i)),
            isHidden = false,
        profileX1_O.layers[#profileX1_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow X1 F' .. tostring(i)),
          isHidden = false,
        profileX2_O.layers[#profileX2_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow X2 F' .. tostring(i)),
          isHidden = false,
          profileX1_O.layers[#profileX1_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow X1 B' .. tostring(i)),
            isHidden = false,
          profileX2_O.layers[#profileX2_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow X2 B' .. tostring(i)),
            isHidden = false,
        profileY1_O.layers[#profileY1_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow Y1 F' .. tostring(i)),
          isHidden = false,
        profileY2_O.layers[#profileY2_O.layers + 1] = {
          name = im.ArrayChar(32, 'Arrow Y2 F' .. tostring(i)),
          isHidden = false,
          profileY1_O.layers[#profileY1_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow Y1 B' .. tostring(i)),
            isHidden = false,
          profileY2_O.layers[#profileY2_O.layers + 1] = {
            name = im.ArrayChar(32, 'Arrow Y2 B' .. tostring(i)),
            isHidden = false,
        if jR.isOverlay then
          jR.displayName = im.ArrayChar(32, 'Overlay ' .. tostring(i))
        else
        else
          jR.displayName = im.ArrayChar(32, jctName .. ' R' .. tostring(i))
        end
@/lua/ge/extensions/flowgraph/nodes/logic/compare.lua
    self.compFunc = function(a, b) end
    err = 'Invalid comparison: ' .. tostring(self.data.comparisonFunc)
  end
function C:_onPropertyChanged(key, val)
  -- log('I', 'compare', "_onPropertyChanged:  Key = "..tostring(key) .. "  Value = "..tostring(value))
  self:refreshFunction()
function C:_onPropertyChanged(key, val)
  -- log('I', 'compare', "_onPropertyChanged:  Key = "..tostring(key) .. "  Value = "..tostring(value))
  self:refreshFunction()
@/lua/ge/extensions/scenario/finishRaceGoal.lua
local function processState(scenario, state, stateData)
  -- log("I", logTag, 'processState called...state:'..tostring(state))
  if state == 'onRaceWaypointReached' then
@/lua/ge/extensions/editor/preferences.lua
local function myUi(cat, subCat, item)
  imgui.Text(tostring(editor.getPreference(item.path)))
end
@/lua/ge/extensions/ui/gridSelectorUtils/buttonModule.lua
    else
      log("E", "", "Button function not found for ID: " .. tostring(buttonId))
    end
@/lua/ge/client/lighting.lua
  -- log('I', 'lightManager', 'initLightingSystems called.....')
  -- log('I', 'lightManager', 'adapterCount = '..tostring(adapterCount))
    local dir, filename, ext = path.splitWithoutExt(filepath)
    -- log('I', 'lightManager', '     loading manager   '..tostring(dir..filename))
    require(dir..filename)
  -- log('I', 'lightManager', 'initLightingSystems called.....')
  -- log('I', 'lightManager', 'adapterCount = '..tostring(adapterCount))
    local dir, filename, ext = path.splitWithoutExt(filepath)
    -- log('I', 'lightManager', '     loading manager   '..tostring(dir..filename))
    require(dir..filename)
@/lua/ge/extensions/tech/partAnnotations.lua
  if color then
    log('I', 'partAnnotations', 'Setting mesh annotation color: ' .. part .. ': ' .. tostring(color.r) .. ', ' .. tostring(color.g) .. ', ' .. tostring(color.b) .. ', ' .. tostring(color.a))
    vehicle:setMeshAnnotationColor(part, color)
  if color then
    log('I', 'partAnnotations', 'Setting mesh annotation color: ' .. part .. ': ' .. tostring(color.r) .. ', ' .. tostring(color.g) .. ', ' .. tostring(color.b) .. ', ' .. tostring(color.a))
    vehicle:setMeshAnnotationColor(part, color)
  if color then
    log('I', 'partAnnotations', 'Setting mesh annotation color: ' .. part .. ': ' .. tostring(color.r) .. ', ' .. tostring(color.g) .. ', ' .. tostring(color.b) .. ', ' .. tostring(color.a))
    vehicle:setMeshAnnotationColor(part, color)
  if color then
    log('I', 'partAnnotations', 'Setting mesh annotation color: ' .. part .. ': ' .. tostring(color.r) .. ', ' .. tostring(color.g) .. ', ' .. tostring(color.b) .. ', ' .. tostring(color.a))
    vehicle:setMeshAnnotationColor(part, color)
@/lua/ge/extensions/c2/webSocketHandler.lua
          type = "error",
          msg  = "Failed to load extension: " .. tostring(err)
        }))
  server, chosenAddress = wsUtils.createOrGetWS("127.0.0.1", port, "", 'c2', "", false)
  log("I", "c2_webSocketHandler", "c2_simScene WebSocket server at: http://" .. chosenAddress .. ":" .. tostring(port))
end
        else
          log("E", "c2_simScene", "Failed to decode JSON: " .. tostring(evt.msg))
        end
@/gameplay/missionTypes/cannon/customNodes/MarkersNode.lua
        local dist = math.floor(pl:getPosition():distance(vehPos))
        debugDrawer:drawTextAdvanced(vehPos, tostring(dist).." m", whiteF, true, false, blackI, false, false)
      end
@/lua/ge/extensions/core/input/bindings.lua
  if state == false then
    log('E', "", "Couldn't decode ffbconfig JSON: "..tostring(ffbConfig))
    return nil
@/lua/ge/extensions/gameplay/drag/utils.lua
    veh:queueLuaCommand('ai.setTarget("drag_stop")')
    veh:queueLuaCommand('ai:scriptStop('..tostring(true)..','..tostring(true)..')')
  end
    veh:queueLuaCommand('ai.setTarget("drag_stop")')
    veh:queueLuaCommand('ai:scriptStop('..tostring(true)..','..tostring(true)..')')
  end
@/lua/ge/extensions/gameplay/crawl/general.lua
            keyLabel = "Attempts",
            valueLabel = tostring(trailStats.attempts)
          })
@/lua/ge/extensions/editor/camPathEditor.lua
        marker.pos,
        String(tostring(index) .. '/' .. #path.markers .. ' -- ' .. string.format('%0.1f', marker.time) .. 's'),
        ColorF(0, 0, 0, 1)
        im.PushStyleColor2(im.Col_Header, isSelected and im.ImVec4(0.3, 0.6, 0.9, 0.8) or im.ImVec4(0, 0, 0, 0))
        if im.Selectable1(tostring(index), isSelected) then
          selectMarker(index)
@/lua/ge/extensions/editor/mapSensorEditor.lua
        im.PushItemWidth(130)
        im.InputFloat("[X-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the X-Axis.')
        im.PushItemWidth(130)
        im.InputFloat("[Y-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Y-Axis.')
        im.PushItemWidth(130)
        im.InputFloat("[Z-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Z-Axis.')
        im.PushItemWidth(130)
        im.InputInt("Horizontal Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the horizontal resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputInt("Vertical Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the vertical resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputFloat("Field Of View ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip('Set the field of view of the sensor.')
        im.PushItemWidth(130)
        im.InputFloat("Near Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the near plane distance of the sensor (min depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Far Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the far plane distance of the sensor (max depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Sensor Refresh Rate ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f s")
        im.tooltip('Set the time between sensor updates.')
        im.PushItemWidth(130)
        im.InputFloat("[X-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the X-Axis.')
        im.PushItemWidth(130)
        im.InputFloat("[Y-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Y-Axis.')
        im.PushItemWidth(130)
        im.InputFloat("[Z-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Z-Axis.')
        im.PushItemWidth(130)
        im.InputInt("Vertical Resolution ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the number of vertical resolution levels.')
        im.PushItemWidth(130)
        im.InputFloat("Vertical Field Of View ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip('Set the vertical field of view, in degrees.')
        im.PushItemWidth(130)
        im.InputFloat("Horizontal Field Of View ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip('Set the horizontal field of view, in degrees.')
        im.PushItemWidth(130)
        im.InputInt("Rotation Frequency (Hz) ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the rotation frequency, in Hz.')
        im.PushItemWidth(130)
        im.InputFloat("Max Detection Range ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the sensor maximum detection range, in meters.')
        im.PushItemWidth(130)
        im.InputFloat("Sensor Refresh Rate ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f s")
        im.tooltip('Set the time between sensor updates.')
        im.PushItemWidth(130)
        im.InputFloat("[X-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the X-Axis.')
        im.PushItemWidth(130)
        im.InputFloat("[Y-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Y-Axis.')
        im.PushItemWidth(130)
        im.InputFloat("[Z-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Z-Axis.')
        im.PushItemWidth(130)
        im.InputInt("Horizontal Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the horizontal resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputInt("Vertical Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the vertical resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputFloat("Field Of View ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip('Set the field of view of the sensor.')
        im.PushItemWidth(130)
        im.InputFloat("Near Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the near plane distance of the sensor (min depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Far Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the far plane distance of the sensor (max depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Range Roundness ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip("Set the 'roundness' of the beam shape.")
        im.PushItemWidth(130)
        im.InputFloat("Range Cutoff Sensitivity ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the sensitivity of the range cutoff.')
        im.PushItemWidth(130)
        im.InputFloat("Range Shape ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the shape across the beam range.')
        im.PushItemWidth(130)
        im.InputFloat("Range Focus ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the sharpness of the shape across the beam range.')
        im.PushItemWidth(130)
        im.InputFloat("Range Min Cutoff ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f m")
        im.tooltip('Set the near plane, in meters.')
        im.PushItemWidth(130)
        im.InputFloat("Range Direct Max Cutoff ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f m")
        im.tooltip('Set the far plane, in meters.')
        im.PushItemWidth(130)
        im.InputFloat("Sensitivity ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f")
        im.tooltip("Set the detection sensitivity.")
        im.PushItemWidth(130)
        im.InputInt("Window Width ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the width of the window used in processing the returns.')
        im.PushItemWidth(130)
        im.InputFloat("Sensor Refresh Rate ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f s")
        im.tooltip('Set the time between sensor updates.')
        im.PushItemWidth(130)
        im.InputFloat("[X-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the X-Axis.')
        im.PushItemWidth(130)
        im.InputFloat("[Y-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Y-Axis.')
        im.PushItemWidth(130)
        im.InputFloat("[Z-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Z-Axis.')
        im.PushItemWidth(130)
        im.InputInt("Horizontal Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the horizontal resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputInt("Vertical Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the vertical resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputFloat("Field Of View ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip('Set the field of view of the sensor.')
        im.PushItemWidth(130)
        im.InputFloat("Near Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the near plane distance of the sensor (min depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Far Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the far plane distance of the sensor (max depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Range Roundness ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip("Set the 'roundness' of the beam shape.")
        im.PushItemWidth(130)
        im.InputFloat("Range Cutoff Sensitivity ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the sensitivity of the range cutoff.')
        im.PushItemWidth(130)
        im.InputFloat("Range Shape ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the shape across the beam range.')
        im.PushItemWidth(130)
        im.InputFloat("Range Focus ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the sharpness of the shape across the beam range.')
        im.PushItemWidth(130)
        im.InputFloat("Range Min Cutoff ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f m")
        im.tooltip('Set the near plane, in meters.')
        im.PushItemWidth(130)
        im.InputFloat("Range Direct Max Cutoff ###" .. tostring(ctr), uiVal, 1.0, nil, "%.4f m")
        im.tooltip('Set the far plane, in meters.')
        im.PushItemWidth(130)
        im.InputInt("Range Bins ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the number of bins to divide the data into, in the range dimension.')
        im.PushItemWidth(130)
        im.InputInt("Azimuth Bins ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the number of bins to divide the data into, in the azimuth dimension.')
        im.PushItemWidth(130)
        im.InputInt("Velocity Bins ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the number of bins to divide the data into, in the velocity dimension.')
        im.PushItemWidth(130)
        im.InputFloat("Min Range ###" .. tostring(ctr), uiVal, 1, nil, "%.2f")
        im.tooltip("Set the minimum range to display in the data.")
        im.PushItemWidth(130)
        im.InputFloat("Max Range ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f")
        im.tooltip("Set the maximum range to display in the data.")
        im.PushItemWidth(130)
        im.InputFloat("Min Velocity ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f")
        im.tooltip("Set the minimum velocity to display in the data.")
        im.PushItemWidth(130)
        im.InputFloat("Max Velocity ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f")
        im.tooltip("Set the maximum velocity to display in the data.")
        im.PushItemWidth(130)
        im.InputFloat("Azimuth Half-Angle ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip("Set the azimuth half-angle, used in data display.")
        im.PushItemWidth(130)
        im.InputFloat("Sensor Refresh Rate ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f s")
        im.tooltip('Set the time between sensor updates.')
@/lua/ge/client/postFx.lua

  -- log('I','postfx','savePresetFile called: '..tostring(filename))
  filename = makeRelativePath(filename,"")
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/disable.lua
  if self.data.useScriptStop then
    veh:queueLuaCommand('ai:scriptStop('..tostring(self.data.handBrakeWhenFinished)..','..tostring(self.data.straightenWheelsWhenFinished)..')')
  else
  if self.data.useScriptStop then
    veh:queueLuaCommand('ai:scriptStop('..tostring(self.data.handBrakeWhenFinished)..','..tostring(self.data.straightenWheelsWhenFinished)..')')
  else
@/lua/common/libs/LuLPeg/lulpeg.lua
    local function errR (_,i)
        error("illegal global read: " .. tostring(i), 2)
    end
    local function errW (_,i, v)
        error("illegal global write: " .. tostring(i)..": "..tostring(v), 2)
    end
    local function errW (_,i, v)
        error("illegal global write: " .. tostring(i)..": "..tostring(v), 2)
    end
    if mt.__mode then
        error("The mode has already been set on table "..tostring(t)..".")
    end
        else
            t_cache[v] = tostring( v )
            table_tostring( v, acc, indent )
    else
        acc[#acc+1] = tostring( v )
    end
        error("bad argument to '"
            ..tostring(func)
            .."' (string expected, got "
            return true, nsi, ci
        end]=]):gsub("__C0__", tostring(pt.aux)))(s_byte, ("").char)
end
            if not LL_ispattern(v) then
                error(("rule 'A' is not a pattern"):gsub("A", tostring(k)))
            end
            if #state.grammars == 0 then
                error(("rule 'XXXX' used outside a grammar"):gsub("XXXX", tostring(name)))
            elseif not state.grammars[#state.grammars][name] then
            elseif not state.grammars[#state.grammars][name] then
                error(("rule 'XXXX' undefined in given grammar"):gsub("XXXX", tostring(name)))
            end
    until ci == 1
    label = type(label) == "string" and "'"..label.."'" or tostring(label)
    error("back reference "..label.." not found")
            (type(pt.aux) == "string" and "\""..pt.aux.."\"")
                          or tostring(pt.aux)
        , " )"
            local prefix = ( type(k)~="string"
                             and tostring(k)
                             or "\""..k.."\"" )
    printers[cap] = function (pt, offset, prefix)
        print(offset..prefix..cap.." "..tostring(pt.aux or ""))
        LL_pprint(pt.pattern, offset.."  ", "")
printers["div_string"] = function (pt, offset, prefix)
    print(offset..prefix..'/string "'..tostring(pt.aux or "")..'"')
    LL_pprint(pt.pattern, offset.."  ", "")
    printers[cap] = function (pt, offset, prefix)
        print(offset..prefix..cap.."( "..tostring(pt.aux).." )")
    end
local function padnum(n)
    n = tostring(n)
    n = n .."."..((" "):rep(4 - #n))
                            caps.kind[ci],
                            ": start = ", tostring(caps.bounds[ci]),
                            " finish = ", tostring(caps.openclose[ci]),
                            ": start = ", tostring(caps.bounds[ci]),
                            " finish = ", tostring(caps.openclose[ci]),
                            caps.aux[ci] and " aux = " or "",
                                type(caps.aux[ci]) == "string" 
                                    and '"'..tostring(caps.aux[ci])..'"'
                                or tostring(caps.aux[ci])
                                    and '"'..tostring(caps.aux[ci])..'"'
                                or tostring(caps.aux[ci])
                            ) or "",
                                type(caps.aux[ci]) == "string" 
                                    and '"'..tostring(caps.aux[ci])..'"'
                                or tostring(caps.aux[ci])
                                    and '"'..tostring(caps.aux[ci])..'"'
                                or tostring(caps.aux[ci])
                            ) or ""
                            "/", kind,
                            " finish = ", tostring(caps.bounds[ci]),
                            " \t", s_sub(sbj, start, (caps.bounds[ci] or 1) - 1)
local function nameify(a, b)
    return tostring(a)..tostring(b)
end
local function nameify(a, b)
    return tostring(a)..tostring(b)
end
function choice (a, b)
    local name = tostring(a)..tostring(b)
    local ch = Builder.ptcache.choice[name]
function choice (a, b)
    local name = tostring(a)..tostring(b)
    local ch = Builder.ptcache.choice[name]
function sequence (a, b)
    local name = tostring(a)..tostring(b)
    local seq = Builder.ptcache.sequence[name]
function sequence (a, b)
    local name = tostring(a)..tostring(b)
    local seq = Builder.ptcache.sequence[name]
@/lua/vehicle/controller/vehicleController/shiftLogic/cvtGearbox.lua
        for j = 1, gearbox.maxGearIndex, 1 do
          local manualMode = "M" .. tostring(j)
          local manualModeIndex = i + j - 1
@/lua/ge/extensions/editor/missionEditor/progressSingle.lua
        for _, c in pairs(missionData) do
          im.Text(tostring(c.text or "(notext?)"))
          im.TableNextColumn()
@/lua/ge/extensions/editor/assemblySpline.lua
          local flag = i == selectedSplineIdx
          if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            selectedSplineIdx = i
          else
            if im.InputText("###" .. tostring(wCtr), splineNamePtr, 32) then
              spline.name = ffi.string(splineNamePtr)
                  tmpPtr = im.BoolPtr(mol.getRigidEnabled(selSpline, mesh.id))
                  if im.Checkbox("###rigid" .. tostring(49925 + rigidIdx), tmpPtr) then
                    local preState = splineMgr.deepCopyAssemblySpline(selSpline)
                  local varTmpPtr = im.BoolPtr(mol.getRigidEnabled(selSpline, variation.id))
                  if im.Checkbox("###rigidVar" .. tostring(49925 + rigidIdx) .. "_" .. tostring(j), varTmpPtr) then
                    local preState = splineMgr.deepCopyAssemblySpline(selSpline)
                  local varTmpPtr = im.BoolPtr(mol.getRigidEnabled(selSpline, variation.id))
                  if im.Checkbox("###rigidVar" .. tostring(49925 + rigidIdx) .. "_" .. tostring(j), varTmpPtr) then
                    local preState = splineMgr.deepCopyAssemblySpline(selSpline)
                  im.NextColumn()
                  im.TextColored(cols.dullWhite, "var" .. tostring(j))
                  im.tooltip("This is variation " .. tostring(j) .. " of the base component.")
                  im.TextColored(cols.dullWhite, "var" .. tostring(j))
                  im.tooltip("This is variation " .. tostring(j) .. " of the base component.")
                  im.NextColumn()
                tmpPtr = im.BoolPtr(mol.getBridgeEnabled(selSpline, mesh.id))
                if im.Checkbox("###bridge" .. tostring(49925 + i), tmpPtr) then
                  local preState = splineMgr.deepCopyAssemblySpline(selSpline)
                  local varTmpPtr = im.BoolPtr(mol.getBridgeEnabled(selSpline, variation.id))
                  if im.Checkbox("###bridgeVar" .. tostring(49925 + i) .. "_" .. tostring(j), varTmpPtr) then
                    local preState = splineMgr.deepCopyAssemblySpline(selSpline)
                  local varTmpPtr = im.BoolPtr(mol.getBridgeEnabled(selSpline, variation.id))
                  if im.Checkbox("###bridgeVar" .. tostring(49925 + i) .. "_" .. tostring(j), varTmpPtr) then
                    local preState = splineMgr.deepCopyAssemblySpline(selSpline)
                  im.NextColumn()
                  im.TextColored(cols.dullWhite, "var" .. tostring(j))
                  im.tooltip("This is variation " .. tostring(j) .. " of the base component.")
                  im.TextColored(cols.dullWhite, "var" .. tostring(j))
                  im.tooltip("This is variation " .. tostring(j) .. " of the base component.")
                  im.NextColumn()
                im.Columns(2, "DistributionCols" .. rigidIdx, false)
                if im.RadioButton2("Round Robin###" .. tostring(wCtr), tmpPtr, 0) then
                  local statePre = splineMgr.deepCopyAssemblySpline(selSpline)
                im.NextColumn()
                if im.RadioButton2("Random###" .. tostring(wCtr), tmpPtr, 1) then
                  local statePre = splineMgr.deepCopyAssemblySpline(selSpline)
                      end
                      im.tooltip("Set the weight for variation " .. tostring(j) .. ".")
                      if im.IsItemActivated() then
                im.Columns(2, "BridgeDistributionCols" .. i, false)
                if im.RadioButton2("Round Robin###" .. tostring(wCtr), tmpPtr, 0) then
                  local statePre = splineMgr.deepCopyAssemblySpline(selSpline)
                im.NextColumn()
                if im.RadioButton2("Random###" .. tostring(wCtr), tmpPtr, 1) then
                  local statePre = splineMgr.deepCopyAssemblySpline(selSpline)
                      end
                      im.tooltip("Set the weight for bridge variation " .. tostring(j) .. ".")
                      if im.IsItemActivated() then
@/lua/ge/extensions/editor/raceEditor/trackLayout.lua
      debugDrawer:drawTextAdvanced(sp.pos,
        String("Split "..tostring(splitCount)),
        ColorF(1,1,1,1),true, false,
@/lua/vehicle/extensions/tech/platooning.lua
  if printDebugLogs then
      log("I", "", "targetSpeed: " .. tostring(targetSpeedVal)
          .. ", currentSpeed: " .. tostring(currentSpeed)
      log("I", "", "targetSpeed: " .. tostring(targetSpeedVal)
          .. ", currentSpeed: " .. tostring(currentSpeed)
          .. ", targetThrottle: " .. tostring(targetThrottle)
          .. ", currentSpeed: " .. tostring(currentSpeed)
          .. ", targetThrottle: " .. tostring(targetThrottle)
          .. ", smoothedThrottle: " .. tostring(throttleValue))
          .. ", targetThrottle: " .. tostring(targetThrottle)
          .. ", smoothedThrottle: " .. tostring(throttleValue))
  end
 
  lastMailboxVersionVehicleIndex = obj:getLastMailboxVersion(tostring(vehicleId)) --NFSA
 
    currentMailboxVersionVehicleIndex = lastMailboxVersionVehicleIndex
    vehicleIndexInPlatoon = (lpack.decode(obj:getLastMailbox(tostring(vehicleId))))-1
   
    
    currentMailboxVersionVehicleIndex = obj:getLastMailboxVersion(tostring(vehicleId))
    vehicleIndexInPlatoon = (lpack.decode(obj:getLastMailbox(tostring(vehicleId))))-1 --NFSA
    currentMailboxVersionVehicleIndex = obj:getLastMailboxVersion(tostring(vehicleId))
    vehicleIndexInPlatoon = (lpack.decode(obj:getLastMailbox(tostring(vehicleId))))-1 --NFSA
    mailboxSensorName = vehicleId.."UltrasonicReading"
    
    currentMailboxVersionVehicleIndex = obj:getLastMailboxVersion(tostring(vehicleId))
    vehicleIndexInPlatoon = (lpack.decode(obj:getLastMailbox(tostring(vehicleId))))-1 --NFSA
    currentMailboxVersionVehicleIndex = obj:getLastMailboxVersion(tostring(vehicleId))
    vehicleIndexInPlatoon = (lpack.decode(obj:getLastMailbox(tostring(vehicleId))))-1 --NFSA
    mailboxSensorName = vehicleId.."UltrasonicReading"
  mode = "platoon"
  currentMailboxVersionVehicleIndex = obj:getLastMailboxVersion(tostring(vehicleId))
  vehicleIndexInPlatoon = (lpack.decode(obj:getLastMailbox(tostring(vehicleId))))-1 --NFSA
  currentMailboxVersionVehicleIndex = obj:getLastMailboxVersion(tostring(vehicleId))
  vehicleIndexInPlatoon = (lpack.decode(obj:getLastMailbox(tostring(vehicleId))))-1 --NFSA
  
@/lua/ge/extensions/career/modules/loanerVehicles.lua
  if rentalVehicleInfo.mileages then
    if rentalVehicleInfo.mileages[tostring(organization.reputation.level)] then
      return rentalVehicleInfo.mileages[tostring(organization.reputation.level)]
    if rentalVehicleInfo.mileages[tostring(organization.reputation.level)] then
      return rentalVehicleInfo.mileages[tostring(organization.reputation.level)]
    else
@/lua/ge/extensions/career/modules/inventory.lua
  for inventoryId, vehicle in pairs(vehicles) do
    data.vehicles[tostring(inventoryId)] = getVehicleUiData(inventoryId, inventoryIdsInGarage)
  end
@/lua/ge/extensions/gameplay/drift/scoring.lua
  if newTier == currentTier + 1 then
    local tierName = tierTranslationPrefix..tostring(newTier)
    extensions.hook("onNewDriftTierReached",driftTiers[newTier])
@/lua/vehicle/controller/vehicleController/shiftLogic/automaticGearbox.lua
  end
  return modePrefix ~= "" and modePrefix .. tostring(gearbox.gearIndex) or automaticHandling.mode
end
      if automaticHandling.mode == "M1" then
        automaticHandling.mode = "M" .. tostring(max(gearbox.gearIndex, 1))
      end
    if mode == "M1" then --we just shifted into M1
      automaticHandling.mode = "M" .. tostring(max(gearbox.gearIndex, 1))
    else
  if automaticHandling.mode == "M1" then --we just shifted into M1
    automaticHandling.mode = "M" .. tostring(max(gearbox.gearIndex, 1))
  end
    if automaticHandling.mode == "M1" then --we just shifted into M1
      automaticHandling.mode = "M" .. tostring(max(gearbox.gearIndex, 1))
    end
        for j = 1, gearbox.maxGearIndex, 1 do
          local manualMode = "M" .. tostring(j)
          local manualModeIndex = i + j - 1
@/lua/ge/extensions/editor/trafficSignalsEditor.lua
      for i, phase in ipairs(currSequence.phases) do
        im.TextUnformatted(tostring(i))
        im.TableNextColumn()

          im.TextUnformatted(tostring(sequence.currStep))
          im.TableNextColumn()

          im.TextUnformatted(tostring(sequence.currPhase))
          im.TableNextColumn()
          end
          timedTexts.signalsInvalid = {"Signal errors: "..tostring(#simLogs).."; see Simulation tab", 12}
          timedTexts.signalsValid = nil
@/lua/ge/extensions/ui/freeroamSelector/general.lua
  end
  log("I", "", "Freeroam selector display data updated to version " .. tostring(version))
  return data
  -- TODO: Implement folder exploration
  log("I", "", "Gameplay selector explore folder: " .. tostring(path))
end
  -- TODO: Implement mod navigation
  log("I", "", "Gameplay selector go to mod: " .. tostring(modId))
end
@/lua/ge/extensions/flowgraph/pin.lua
        key = '_value'
        --print('> > > > > KEY: ' .. tostring(key))
        if tbl.id == GlobTrackingId then
          print("Changin Pin value to " .. tostring(value))
          print(debug.tracesimple())
  end
  return tostring(val)
end
      im.SameLine()
      im.TextUnformatted(tostring(displayName) .. '=' .. ui_flowgraph_editor.shortValueString(constValue, self.type)) --formatValueForDisplay(constValue))
      -- else
      -- else
      --  im.TextUnformatted(tostring(self.name) .. '= (' .. tostring(self.type) .. ')')
      --end
      -- else
      --  im.TextUnformatted(tostring(self.name) .. '= (' .. tostring(self.type) .. ')')
      --end
    else
      typeTxt = typeTxt .. ' type: ' .. tostring(self.type)
    end
    --im.Text(val)
    --im.Text("_hardcodedDummyPin = " .. tostring(self._hardcodedDummyPin))
    --im.Text("HC Type = " .. tostring(self.hardCodeType))
    --im.Text("_hardcodedDummyPin = " .. tostring(self._hardcodedDummyPin))
    --im.Text("HC Type = " .. tostring(self.hardCodeType))
    --im.Text(ui_flowgraph_editor.fullValueString(val, self.hardCodeType and self.hardCodeType or self.type))
    --im.Text(ui_flowgraph_editor.fullValueString(val, self.hardCodeType and self.hardCodeType or self.type))
    --im.TextUnformatted('PIN ID: ' .. tostring(self.id))
    --im.TextUnformatted("lastUsed: " .. tostring(self._frameLastUsed))
    --im.TextUnformatted('PIN ID: ' .. tostring(self.id))
    --im.TextUnformatted("lastUsed: " .. tostring(self._frameLastUsed))
      im.Separator();
      im.TextUnformatted('Description: ' .. tostring(self.description))
    end
    im.Separator()
    im.Text("id: %s", tostring(self.id))
    im.Text("Node: %s", tostring(self.node.id))
    im.Text("id: %s", tostring(self.id))
    im.Text("Node: %s", tostring(self.node.id))
    im.Separator()
@/lua/ge/extensions/editor/toolUtilities/util.lua
  if bmp:saveFile(path) then
    log('I', logTag, 'Wrote RGBA mask PNG to: ' .. tostring(path))
  else
  else
    log('E', logTag, 'Failed to write mask PNG to: ' .. tostring(path))
  end
  if bmp:saveFile(path) then
    log('I', logTag, 'writePathsToPng(): wrote to ' .. tostring(path))
  else
  else
    log('E', logTag, 'writePathsToPng(): failed to save image to ' .. tostring(path))
  end
  if bmp:saveFile(outPath) then
    log('I', logTag, 'writeWidthsToPng(): wrote to ' .. tostring(outPath))
  else
  else
    log('E', logTag, 'writeWidthsToPng(): failed to save image to ' .. tostring(outPath))
  end
@/lua/ge/extensions/util/docCreator.lua
  if langNow ~= lang then
    log('E', '', 'Unable to switch to language ' .. tostring(lang) .. ' - game is chose ' .. tostring(langNow))
  end
  if langNow ~= lang then
    log('E', '', 'Unable to switch to language ' .. tostring(lang) .. ' - game is chose ' .. tostring(langNow))
  end
local function exportDataLangSpecific(job, lang)
  log('I', '', 'Processing language: ' .. tostring(lang))
  local langFilename = lang:gsub('-', '_')
  versionInfo['beamng_appname'] = beamng_appname
  versionInfo['shipping_build'] = tostring(shipping_build)
  jsonOut('game_version.json', versionInfo)
@/lua/ge/extensions/editor/slotTrafficEditor.lua
  if camNodeSqDist < square(clamp(editor.getPreference("gizmos.visualization.visualizationDrawDistance") * 0.5, 50, 250)) then
    debugDrawer:drawText(n.pos, String(tostring(nid)), linkBaseColor)
  end
                  im.TableSetColumnIndex(2)
                  im.Text(tostring(#road.controlPoints))
            if props.oneWay ~= nil then
              im.Text("One Way: " .. tostring(props.oneWay))
            end
@/lua/ge/extensions/editor/scriptAIManager.lua
local function stopRecording(bo, vehId)
  bo:queueLuaCommand('obj:queueGameEngineLua("extensions.hook(\\"onVehicleSubmitRecording\\","..tostring(objectId)..","..serialize(ai.stopRecording())..")")')
  vehState[vehId] = 'idle'
  if editor.beginWindow(toolWindowName, "Script AI Manager") then
    be:queueAllObjectLua('obj:queueGameEngineLua("extensions.hook(\\"onVehicleSubmitInfo\\","..tostring(objectId)..","..serialize(ai.scriptState())..")")')
    local objMax = be:getObjectCount()-1

      local vehIdtxt = tostring(vehId) .. ' - ' .. tostring(bo:getName()) .. ' - ' .. tostring(bo.JBeam)

      local vehIdtxt = tostring(vehId) .. ' - ' .. tostring(bo:getName()) .. ' - ' .. tostring(bo.JBeam)

      local vehIdtxt = tostring(vehId) .. ' - ' .. tostring(bo:getName()) .. ' - ' .. tostring(bo.JBeam)

      local statetxt = tostring(vehState[vehId])
      if vi and vehState[vehId] == 'playing' and vi and vi.endScriptTime then

      if im.RadioButton2(vehIdtxt .. '##' .. 'vehRecording' .. tostring(vehId), vehicleChooser, i) then
        be:enterVehicle(0, bo)
        local p1 = bo:getPosition() + vec3(0, 0, 4)
        local dbgTxt = ' ' .. activetxt .. tostring(vehId) .. ' - ' .. tostring(bo:getName()) .. ': ' .. statetxt
        debugDrawer:drawText(p1, String(dbgTxt), ColorF(0, 0, 0, 1))
        local p1 = bo:getPosition() + vec3(0, 0, 4)
        local dbgTxt = ' ' .. activetxt .. tostring(vehId) .. ' - ' .. tostring(bo:getName()) .. ': ' .. statetxt
        debugDrawer:drawText(p1, String(dbgTxt), ColorF(0, 0, 0, 1))
          end
          ffi.copy(tmpSaveFilename, tostring(vehId) .. '-' .. tostring(bo:getName()) .. '-' .. tostring(bo.JBeam))
          im.OpenPopup('Save Recording##'..vehId)
          end
          ffi.copy(tmpSaveFilename, tostring(vehId) .. '-' .. tostring(bo:getName()) .. '-' .. tostring(bo.JBeam))
          im.OpenPopup('Save Recording##'..vehId)
          end
          ffi.copy(tmpSaveFilename, tostring(vehId) .. '-' .. tostring(bo:getName()) .. '-' .. tostring(bo.JBeam))
          im.OpenPopup('Save Recording##'..vehId)

  --print("camDist = " .. tostring(camDist))
  local cutoffPointSq = math.min(200, math.max(100, camDist))
  local cutoffPointSq = math.min(200, math.max(100, camDist))
  --print("cutoffPoint = " .. tostring(cutoffPointSq))
  cutoffPointSq = cutoffPointSq * cutoffPointSq
local function onVehicleSubmitRecording(vehId, data)
  --print(' * got data: ' .. tostring(vehId)) -- .. ' : ' .. dumps(data))
  recordings[vehId] = data
@/lua/ge/client/postFx/ssao.lua
  if quality ~= currentQuality then
    currentQuality = tostring(clamp(round(tonumber(quality)), 0, 2))
    local ssaoPostFx = scenetree.findObject("SSAOPostFx")
@/lua/vehicle/scriptai.lua
      obj:requestReset(RESET_PHYSICS)
      obj:queueGameEngineLua("getObjectByID(" .. tostring(obj:getId()) .. "):resetBrokenFlexMesh()")
      local rot = quatFromDir(dir:cross(up):cross(up), up)
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/countdown.lua
      ttl = 1,
      msg = tostring(msg),
      category =  ("countdown__"..self.id),
@/lua/ge/extensions/gameplay/rally/driveline/drivelineRoute.lua
    if not stableId then
      stableId = "point_" .. tostring(i)
      -- log('E', logTag, "expected stableId for point: " .. i .. ". using '" .. stableId .. "' instead.")
    if not rpCS or not rpCE then
      log('E', logTag, "No route point found for " .. pn.name..". rpCS="..tostring(not not rpCS).." rpCE="..tostring(not not rpCE))
      pn:setCachedLength(0.0)
    if not rpCS or not rpCE then
      log('E', logTag, "No route point found for " .. pn.name..". rpCS="..tostring(not not rpCS).." rpCE="..tostring(not not rpCE))
      pn:setCachedLength(0.0)
  if not RallyEnums.triggerTypeName[triggerType] then
    log('E', logTag, "Invalid trigger type: " .. tostring(triggerType))
    return
    -- bypass this tick if the speed is very high, which indicates a reset.
    -- log('W', logTag, string.format('detected insane speed > 1000mph speed=%0.2fmph recalcNeeded=%s', speedMph, tostring(self.recalcNeeded)))
    return
    else
      return tostring(v)
    end
  for k, v in pairs(t) do
    s = s .. tostring(k) .. "=" .. valToStr(v) .. " "
  end
@/lua/ge/extensions/editor/gen/terrain.lua
    tfr = tb:getWorldBox().minExtents
        lo('?? tersize:'..tostring(tersize))
end
local function terFlat()
        lo('>> terFlat:'..tostring(tb))
--    for i=1
    end
        lo('??************************ terFlat:'..tostring(tersize)..':'..tostring(tfr))
    for i=1,tersize.y do
    end
        lo('??************************ terFlat:'..tostring(tersize)..':'..tostring(tfr))
    for i=1,tersize.y do
    for _, m in ipairs(amat) do -- get all existing materials from terrain
            lo('??^^^^^^^^^^^^^^^^^^^^^^^^^ for_MAT:'..tostring(m:getInternalName())..':'..tostring(m.baseColorBaseTex))
        m.baseColorBaseTex = '/levels/test_art_v2/art/terrains/t_terrain_base_dirt_b.png'
    for _, m in ipairs(amat) do -- get all existing materials from terrain
            lo('??^^^^^^^^^^^^^^^^^^^^^^^^^ for_MAT:'..tostring(m:getInternalName())..':'..tostring(m.baseColorBaseTex))
        m.baseColorBaseTex = '/levels/test_art_v2/art/terrains/t_terrain_base_dirt_b.png'
]]
        lo('<< Ter.clear:'..tostring(tb:getMaterialIdxWs(vec3(1,1))))
end
--                if pma:distance(vec3(c.x,c.y)) < R then
--                        lo('?? to_mm:'..i..':'..j..':'..tostring(ima)..':'..tostring(pma))
                    afill[ima][#afill[ima]+1] = pma
--                if pma:distance(vec3(c.x,c.y)) < R then
--                        lo('?? to_mm:'..i..':'..j..':'..tostring(ima)..':'..tostring(pma))
                    afill[ima][#afill[ima]+1] = pma
    end
        lo('<< regionPlot:'..dma..':'..tostring(T.out['white'] and #T.out['white'] or nil))
end
            if dist < path[i].w/2+margin/2 and U.vang(U.mod(i+1,path).p-path[i].p, pp-path[i].p, true)>0 then
--                    U.dump(dhit,'??^^^^^^^^^^ is_CLOSE:'..i..':'..tostring(pp)..':'..U.vang(U.mod(i+1,path).p-path[i].p,pp-path[i].p,true)) --..':'..tostring(pp-a)..':'..tostring(d-c)..':'..tostring(path[i].w))
--                    toMark({path[i].p}, 'blue', nil, 0.1, 1)
            if dist < path[i].w/2+margin/2 and U.vang(U.mod(i+1,path).p-path[i].p, pp-path[i].p, true)>0 then
--                    U.dump(dhit,'??^^^^^^^^^^ is_CLOSE:'..i..':'..tostring(pp)..':'..U.vang(U.mod(i+1,path).p-path[i].p,pp-path[i].p,true)) --..':'..tostring(pp-a)..':'..tostring(d-c)..':'..tostring(path[i].w))
--                    toMark({path[i].p}, 'blue', nil, 0.1, 1)
            if dist < path[i].w/2+margin/2 and U.vang(U.mod(i+1,path).p-path[i].p, pp-path[i].p, true)>0 then
--                    U.dump(dhit,'??^^^^^^^^^^ is_CLOSE:'..i..':'..tostring(pp)..':'..U.vang(U.mod(i+1,path).p-path[i].p,pp-path[i].p,true)) --..':'..tostring(pp-a)..':'..tostring(d-c)..':'..tostring(path[i].w))
--                    toMark({path[i].p}, 'blue', nil, 0.1, 1)
            if dist < path[i].w/2+margin/2 and U.vang(U.mod(i+1,path).p-path[i].p, pp-path[i].p, true)>0 then
--                    U.dump(dhit,'??^^^^^^^^^^ is_CLOSE:'..i..':'..tostring(pp)..':'..U.vang(U.mod(i+1,path).p-path[i].p,pp-path[i].p,true)) --..':'..tostring(pp-a)..':'..tostring(d-c)..':'..tostring(path[i].w))
--                    toMark({path[i].p}, 'blue', nil, 0.1, 1)
                    if dbg then
                        lo('??^^^^^^^^^^ is_CLOSE:'..i..':'..tostring(pp)..':'..U.vang(U.mod(i+1,path).p-path[i].p,pp-path[i].p,true)) --..':'..tostring(pp-a)..':'..tostring(d-c)..':'..tostring(path[i].w))
                        toMark({a,b}, 'cyan', nil, 0.1, 1)
                    if dbg then
                        lo('??^^^^^^^^^^ is_CLOSE:'..i..':'..tostring(pp)..':'..U.vang(U.mod(i+1,path).p-path[i].p,pp-path[i].p,true)) --..':'..tostring(pp-a)..':'..tostring(d-c)..':'..tostring(path[i].w))
                        toMark({a,b}, 'cyan', nil, 0.1, 1)
                    if dbg then
                        lo('??^^^^^^^^^^ is_CLOSE:'..i..':'..tostring(pp)..':'..U.vang(U.mod(i+1,path).p-path[i].p,pp-path[i].p,true)) --..':'..tostring(pp-a)..':'..tostring(d-c)..':'..tostring(path[i].w))
                        toMark({a,b}, 'cyan', nil, 0.1, 1)
                    if dbg then
                        lo('??^^^^^^^^^^ is_CLOSE:'..i..':'..tostring(pp)..':'..U.vang(U.mod(i+1,path).p-path[i].p,pp-path[i].p,true)) --..':'..tostring(pp-a)..':'..tostring(d-c)..':'..tostring(path[i].w))
                        toMark({a,b}, 'cyan', nil, 0.1, 1)
                    ahit[#ahit+1] = {p=p, ang=sgn*ang, w=path[i].w, ind=i, isclose = true}
--                        lo('?? hit1:'..tostring(p))
                    hasclose = true
                    ahit[#ahit+1] = {p=p, ang=sgn*ang, w=path[i].w, ind=i, isclose=true}
--                        lo('?? hit2:'..tostring(p))
                    hasclose = true
--                ahit[#ahit+1] = {p=p, ang=U.vang(p-a, d-c, true), w=path[i].w}
--                    U.dump(ahit, '?? CLOSE_dhit:'..tostring(b))
                    if #ahit == 3 then
            local inout = U.vang(p-a, d-c, true)
--                lo('?? hit:'..i) --..tostring(p)..':'..inout)
            local ang = U.vang(p-a, d-c, true)
        local h1,h2 = ahit[i],ahit[i+1]
--            U.dump(h1, '?? hit1:'..i..':'..tostring(ahit[i].p))
--            U.dump(h2, '?? hit2:'..i..':'..tostring(ahit[i].p))
--            U.dump(h1, '?? hit1:'..i..':'..tostring(ahit[i].p))
--            U.dump(h2, '?? hit2:'..i..':'..tostring(ahit[i].p))
        local list = {
                if #aslice == 1 then
                    lo('?? to_SLICE:'..list[1]:distance(list[2])..':'..#ahit..':'..tostring(a)..':'..tostring(b))
                    toMark({list[1]},'red',nil,0.1,1)
                if #aslice == 1 then
                    lo('?? to_SLICE:'..list[1]:distance(list[2])..':'..#ahit..':'..tostring(a)..':'..tostring(b))
                    toMark({list[1]},'red',nil,0.1,1)
    if not rand_rate then rand_rate = default.RAND_RATE end
--        lo('>> regionSlice:'..tostring(margin)..':'..tostring(space))
    for i=1,#loop do
    if not rand_rate then rand_rate = default.RAND_RATE end
--        lo('>> regionSlice:'..tostring(margin)..':'..tostring(space))
    for i=1,#loop do
--        local p,s = U.line2seg(n, n+dir, vec3(0,0,0), dnorm)
--            lo('?? regionSlice:'..tostring(s)..':'..tostring(n)..':'..tostring(n+dir)..':'..tostring(dnorm))
--            if true then return end
--        local p,s = U.line2seg(n, n+dir, vec3(0,0,0), dnorm)
--            lo('?? regionSlice:'..tostring(s)..':'..tostring(n)..':'..tostring(n+dir)..':'..tostring(dnorm))
--            if true then return end
--        local p,s = U.line2seg(n, n+dir, vec3(0,0,0), dnorm)
--            lo('?? regionSlice:'..tostring(s)..':'..tostring(n)..':'..tostring(n+dir)..':'..tostring(dnorm))
--            if true then return end
--        local p,s = U.line2seg(n, n+dir, vec3(0,0,0), dnorm)
--            lo('?? regionSlice:'..tostring(s)..':'..tostring(n)..':'..tostring(n+dir)..':'..tostring(dnorm))
--            if true then return end
    end
--        lo('?? regionSlice:'..tostring(dmi)..':'..tostring(imi)..':'..tostring(loop[1]))
    local function forCorner(ind,marg)
    end
--        lo('?? regionSlice:'..tostring(dmi)..':'..tostring(imi)..':'..tostring(loop[1]))
    local function forCorner(ind,marg)
    end
--        lo('?? regionSlice:'..tostring(dmi)..':'..tostring(imi)..':'..tostring(loop[1]))
    local function forCorner(ind,marg)
--                lo('?? forCorner:'..ind..':'..dira..':'..dirb)
--                lo('?? dir_AB:'..tostring(p)..':'..tostring(bfr.list[1])..':'..dira..':'..dirb)
            return D.borderCross(bfr.body, bto.body
--                lo('?? forCorner:'..ind..':'..dira..':'..dirb)
--                lo('?? dir_AB:'..tostring(p)..':'..tostring(bfr.list[1])..':'..dira..':'..dirb)
            return D.borderCross(bfr.body, bto.body
        end
--            lo('?? if_CORNER:'..tostring(cb)..':'..tostring(ce))
--            toMark({cb, ce},'blue',nil,0.1,1)
        end
--            lo('?? if_CORNER:'..tostring(cb)..':'..tostring(ce))
--            toMark({cb, ce},'blue',nil,0.1,1)
            local a,b = aslice[#aslice][1],aslice[#aslice][2]
                lo('?? dSLICE:'..nslice..':'..#aslice..':'..tostring(a))
                local am1 = {}
        else
            lo('!! ERR_NO_CORNERS:'..tostring(cb)..':'..tostring(ce)..':'..tostring(imi)..':'..tostring(ima))
--            if not cb then
        else
            lo('!! ERR_NO_CORNERS:'..tostring(cb)..':'..tostring(ce)..':'..tostring(imi)..':'..tostring(ima))
--            if not cb then
        else
            lo('!! ERR_NO_CORNERS:'..tostring(cb)..':'..tostring(ce)..':'..tostring(imi)..':'..tostring(ima))
--            if not cb then
        else
            lo('!! ERR_NO_CORNERS:'..tostring(cb)..':'..tostring(ce)..':'..tostring(imi)..':'..tostring(ima))
--            if not cb then
        local dira, dirb = close(p, bfr.list[1]) and 1 or -1, close(p, bto.list[1]) and 1 or -1
--            lo('?? dir_AB:'..tostring(p)..':'..tostring(bfr.list[1])..':'..dira..':'..dirb)
        local c = D.borderCross(bfr.body, bto.body
        local dira, dirb = close(p, bfr.list[1]) and 1 or -1, close(p, bto.list[1]) and 1 or -1
--            lo('?? dir_AB:'..tostring(p)..':'..tostring(bfr.list[1])..':'..dira..':'..dirb)
        local c = D.borderCross(bfr.body, bto.body
        if c then
--            lo('?? fr_to:'..bfr.ind..':'..bto.ind..':'..tostring(c))
                toMark({c, c+dir},'blue',nil,0.1,1)
    local b = lst[i]
--        lo('?? sectorPlot:'..tostring(b))
--        U.dump(b, '?? sectorPlot:'..tostring(b))
--        lo('?? sectorPlot:'..tostring(b))
--        U.dump(b, '?? sectorPlot:'..tostring(b))
--        toMark(b.list, 'yel')
            loop[#loop+1] = {p = list[i], w = br.aw[i], seg = br}
--                lo('?? to_LOOP:'..i..':'..tostring(loop[#loop]))
        end
--            toMark(dsc.list,'yel')
--            lo('?? crossNext:'..dsc.ind..':'..tostring(dsc.jfr)..':'..dsc.jto)
--            local a = junc.list[3].list[1]
--            local b = junc.list[3].list[#junc.list[3].list]
--            lo('?? for_a:'..tostring(a))
--            toMark({a, b}, 'yel', nil, 0.5, 1)
        if not junc then
            lo('!! ERR_crossNext:'..tostring(ni)..':'..tostring(ni == 1 and dsc.jfr or dsc.jto)..':'..#ajunc)
--            U.dump(dsc, '!! ERR_crossNext:'..tostring(ni)..':'..tostring(ni == 1 and dsc.jfr or dsc.jto)..':'..#ajunc)
        if not junc then
            lo('!! ERR_crossNext:'..tostring(ni)..':'..tostring(ni == 1 and dsc.jfr or dsc.jto)..':'..#ajunc)
--            U.dump(dsc, '!! ERR_crossNext:'..tostring(ni)..':'..tostring(ni == 1 and dsc.jfr or dsc.jto)..':'..#ajunc)
            lo('!! ERR_crossNext:'..tostring(ni)..':'..tostring(ni == 1 and dsc.jfr or dsc.jto)..':'..#ajunc)
--            U.dump(dsc, '!! ERR_crossNext:'..tostring(ni)..':'..tostring(ni == 1 and dsc.jfr or dsc.jto)..':'..#ajunc)
            return
            lo('!! ERR_crossNext:'..tostring(ni)..':'..tostring(ni == 1 and dsc.jfr or dsc.jto)..':'..#ajunc)
--            U.dump(dsc, '!! ERR_crossNext:'..tostring(ni)..':'..tostring(ni == 1 and dsc.jfr or dsc.jto)..':'..#ajunc)
            return
                    toMark({seg.list[1],hit.p},'green',nil,0.1,1)
                    lo('?? dd:'..tostring(hit.p)..':'..tostring(seg.list[1]))
                end
                    toMark({seg.list[1],hit.p},'green',nil,0.1,1)
                    lo('?? dd:'..tostring(hit.p)..':'..tostring(seg.list[1]))
                end
            end
--                lo('?? if_SKIp:'..tostring(s.skip))
            s.skip = nil
    if not cb then
        lo('!! NO_CB:'..tostring(b))
        return
-- GET LOOP
--        lo('?? if_line:'..i..':'..tostring(adec[b.ind].isline)..':'..tostring(dir))
--                        loop = {{p=reg.p, w=b.aw[k==b.jfr and 1 or #b.aw], seg=b}}
-- GET LOOP
--        lo('?? if_line:'..i..':'..tostring(adec[b.ind].isline)..':'..tostring(dir))
--                        loop = {{p=reg.p, w=b.aw[k==b.jfr and 1 or #b.aw], seg=b}}
--[[
                lo('?? for_SLI1:'..tostring(asli1 and #asli1 or nil)..':'..#loop)
            for _,s in pairs(asli1) do
    if desc then
--            lo('?? if_ASL:'..tostring(desc.aslice))
        desc.aslice = aslice
        for t,v in pairs(loop) do
            lo('?? in_LOOP:'..t..':'..tostring(v.p)..':'..tostring(v.w))
            if not v.w then
        for t,v in pairs(loop) do
            lo('?? in_LOOP:'..t..':'..tostring(v.p)..':'..tostring(v.w))
            if not v.w then
        U.dump(aregion, '?? roadPlace_areg:')
        local outputFile = io.open('./tmp/reg_save_'..tostring(os.clock())..'.json', "w")
        lo('??^^^^^^^^^^^^^^^^ if_FILE:'..tostring(outputFile))
        local outputFile = io.open('./tmp/reg_save_'..tostring(os.clock())..'.json', "w")
        lo('??^^^^^^^^^^^^^^^^ if_FILE:'..tostring(outputFile))
        if outputFile then
            local cr = mask[i][j]
--                    lo('?? for_cr:'..i..':'..j..':'..tostring(cr))
            -- check the neighbourhood
--                            if #ari == 3 then
--                                U.dump(ari, '?? to_ARI:'..i..':'..j..':'..tostring(cr)..':'..val)
--                                am1[#am1+1] = toWorld(j,i)
            for j =i+1,#anode do
--                    lo('?? if_merge:'..i..':'..j..':'..tostring(anode[i].p)..':'..tostring(anode[j].p)..':'..anode[i].p:distance(anode[j].p))
                if anode[i].p:distance(anode[j].p)
            for j =i+1,#anode do
--                    lo('?? if_merge:'..i..':'..j..':'..tostring(anode[i].p)..':'..tostring(anode[j].p)..':'..anode[i].p:distance(anode[j].p))
                if anode[i].p:distance(anode[j].p)
            local sinv = U.stamp({nito, ni}, true)
--                lo('?? if_STAMP:'..i..':'..stamp..':'..tostring(aseg[stamp]))
            if aseg[sinv] and #U.index(aseg[sinv].areg,i)==0 then
                if s.areg[1] == 1 and s.areg[2] == 3 then
                    lo('??_____________________ if_IMI12:'..tostring(imi))
                end
--                    local ne = s.desc.body:getEdgeCount()
--                    U.dump(s.desc, '?? pre_SPLIT:'..tostring(s.desc.body)..':'..ne)
--                pair = D.decalSplit(s.desc, pmi,true)
--                pair = D.decalSplit(s.desc, pmi,true)
--                    lo('?? R1_OUT:'..tostring(pair))
                pair = D.decalSplit(s.desc,pmi,true)
--        for i,c in pairs(ajunc) do
--            lo('?? for_junc:'..i..':'..tostring(c.p))
--        end
        for k,c in pairs(ajunc) do
--                lo('?? if_dist:'.._..':'..tostring(c.p)..':'..tostring(reg.p))
            if c.p:distance(reg.p) < U.small_dist then
        for k,c in pairs(ajunc) do
--                lo('?? if_dist:'.._..':'..tostring(c.p)..':'..tostring(reg.p))
            if c.p:distance(reg.p) < U.small_dist then
--                        lo('?? for_SEC:'..t..':'..i)
--                    U.dump(adec[b.ind], '?? if_line:'..i..':'..tostring(adec[b.ind].isline))
                        if (not dbc or #dbc==0) or (dbc and i==dbc[2]) then
            loop[#loop+1] = {p = list[i], w = br.aw[i], seg = br}
--                lo('?? to_LOOP:'..i..':'..tostring(loop[#loop]))
        end
        local junc = ajunc[ni == 1 and dsc.jfr or dsc.jto]
--            lo('?? crossNext:'..dsc.ind..':'..tostring(dsc.jfr)..':'..dsc.jto)
--            local a = junc.list[3].list[1]
--            local b = junc.list[3].list[#junc.list[3].list]
--            lo('?? for_a:'..tostring(a))
--            toMark({a, b}, 'yel', nil, 0.5, 1)
-- GET LOOP
                        lo('?? if_line:'..i..':'..tostring(adec[b.ind].isline)..':'..tostring(dir))
--                        loop = {{p=reg.p, w=b.aw[k==b.jfr and 1 or #b.aw], seg=b}}
-- GET LOOP
                        lo('?? if_line:'..i..':'..tostring(adec[b.ind].isline)..':'..tostring(dir))
--                        loop = {{p=reg.p, w=b.aw[k==b.jfr and 1 or #b.aw], seg=b}}
]]
--                            U.dump(adec[b.ind], '??^^^^^^^^^^^^^^ for_P:'.._..':'..tostring(reg.p))
--                        local bnxt = crossNext(b, 2)

--                    U.dump(c.list,'?? SLICE:'..#c.list..':'.._..':'..tostring(c.p))
--                    U.dump(c.list,'?? SLICE2:'..#c.list)
                    local reg = aregion[aind[2] ]
                        lo('?? for_bound:'..key..':'..tostring(pm)..':'..tostring(reg.p)..':'..tostring(c))
                    local reg = aregion[aind[2] ]
                        lo('?? for_bound:'..key..':'..tostring(pm)..':'..tostring(reg.p)..':'..tostring(c))
                    local reg = aregion[aind[2] ]
                        lo('?? for_bound:'..key..':'..tostring(pm)..':'..tostring(reg.p)..':'..tostring(c))
                        local pb = reg.p - 1.5*r*reg.w*(pm-reg.p):normalized()
                            lo('?? for_dec:'..tostring(pb)..':'..tostring(s[1])..':'..r..':'..(r*reg.w))
                            toMark({s[1],pb}, 'cyan', nil, 0.05, 0.8)
                        local pb = reg.p - 1.5*r*reg.w*(pm-reg.p):normalized()
                            lo('?? for_dec:'..tostring(pb)..':'..tostring(s[1])..':'..r..':'..(r*reg.w))
                            toMark({s[1],pb}, 'cyan', nil, 0.05, 0.8)
    if to then
        print('?? to_DEL:'..tostring(to)..':'..tostring(tonumber(to))..':'..to:getID())
        to:delete()
    if to then
        print('?? to_DEL:'..tostring(to)..':'..tostring(tonumber(to))..':'..to:getID())
        to:delete()
    )
        print('??^^^^^^^^^^^^^^^^^^^ if_DONE:'..tostring(done)..':'..tostring(scenetree.findObject('m_plaster_worn_01_bat')))
    )
        print('??^^^^^^^^^^^^^^^^^^^ if_DONE:'..tostring(done)..':'..tostring(scenetree.findObject('m_plaster_worn_01_bat')))
    to = scenetree.findObject(terrBlockName)
        print('?? if_NEW:'..tostring(to)..':'..tostring(groupEdit))
    groupEdit:addObject(terrBlock)
    to = scenetree.findObject(terrBlockName)
        print('?? if_NEW:'..tostring(to)..':'..tostring(groupEdit))
    groupEdit:addObject(terrBlock)
    elseif key == 'sec_grid' then
--            lo('?? apply_for_LOOP:'..tostring(T.out.insector)..':'..#adec)
        local loop = aloop[T.out.insector]
        c[4] = legend[key][3]
--                lo('?? for_LKEY:'..tostring(key)..':'..tostring(d.amark and #d.amark or nil))
        if d.amark then
        c[4] = legend[key][3]
--                lo('?? for_LKEY:'..tostring(key)..':'..tostring(d.amark and #d.amark or nil))
        if d.amark then
        if d.amark then
--                lo('?? for_LKEY2:'..tostring(key)..':'..tostring(d.amark and #d.amark or nil)..':'..tostring(legend[key][2])..':'..tostring(d.amark[1]))
            for _,p in pairs(d.amark) do
        if d.amark then
--                lo('?? for_LKEY2:'..tostring(key)..':'..tostring(d.amark and #d.amark or nil)..':'..tostring(legend[key][2])..':'..tostring(d.amark[1]))
            for _,p in pairs(d.amark) do
        if d.amark then
--                lo('?? for_LKEY2:'..tostring(key)..':'..tostring(d.amark and #d.amark or nil)..':'..tostring(legend[key][2])..':'..tostring(d.amark[1]))
            for _,p in pairs(d.amark) do
        if d.amark then
--                lo('?? for_LKEY2:'..tostring(key)..':'..tostring(d.amark and #d.amark or nil)..':'..tostring(legend[key][2])..':'..tostring(d.amark[1]))
            for _,p in pairs(d.amark) do
            c[4] = legend[key][3]
--                lo('?? for_mark:'..tostring(T.out[key][1]))
            for i,p in pairs(T.out[key]) do
@/lua/ge/extensions/core/online.lua
  if postFileName then
    d.priv.postFileName = tostring(postFileName)
  end
  d.priv.authorizationHeader = authorizationHeader
  -- print('calling API: ' .. tostring(reqType) .. ' | request: ' .. dumps(d))
  if not r then
    log('E', 'online', 'unknown request completed: '..tostring(id))
    log('E', 'online', 'curlCode= '..dumps(curlCode))
@/lua/ge/server/commands.lua
  if not cam then
    log("E", "", "Cannot setCamera, camera not found: "..tostring("gameCamera"))
    return
@/lua/vehicle/controller/bypassDampers.lua
  if not zone then
    log("E", "bypassDamper.setDamperZone", "Can't find zone with Id: " .. tostring(zoneId))
    return
@/lua/vehicle/extensions/gameplayInterfaceModules/interactAI.lua
    BeamEngine:queueAllObjectLuaExcept('ai.driveInLane("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setState({mode = "random", extAggression = 1, targetObjectID = ' .. tostring(objectId) .. "})", objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setRacing(false)', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.driveInLane("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setState({mode = "flee", targetObjectID = ' .. tostring(objectId) .. "})", objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setRacing(false)', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.driveInLane("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setState({mode = "chase", targetObjectID = ' .. tostring(objectId) .. "})", objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setRacing(false)', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.driveInLane("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setState({mode = "follow", targetObjectID = ' .. tostring(objectId) .. "})", objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setRacing(false)', objectId)
@/lua/ge/extensions/gameplay/rally/loop/rallyLoopManager.lua
  self.missionDir = missionDir
  log('D', logTag, 'missionId='..tostring(missionId)..' missionDir='..tostring(missionDir))
  self.missionDir = missionDir
  log('D', logTag, 'missionId='..tostring(missionId)..' missionDir='..tostring(missionDir))
        self.currentMissionIndex = 1
        log('D', logTag, 'Initialized to first mission: ' .. tostring(self.missionSequence[1]))
      end
  else
    log('W', logTag, 'Could not find mission instance for id: '..tostring(missionId))
  end
  local nextMissionId = self.missionSequence[self.currentMissionIndex]
  log('D', logTag, 'Next mission ID: '..tostring(nextMissionId))
  return nextMissionId
    if tod then
      -- log('D', logTag, tostring(tod))
    else
  log('D', logTag, string.format('Road section %d: TC_in=%s, TC_out=%s, isServiceIn=%s, lastTCLabel=%s',
    roadSectionCount, tcInLabel or 'nil', tcOutLabel or 'nil', tostring(isServiceInRoadSection), updatedLastTCLabel or 'nil'))
      ssLabel = "SS" .. nextSSNumber
      ssLabel = tostring(nextSSNumber)
      nextSSNumber = nextSSNumber + 1  -- Increment for next stage
      log('D', logTag, string.format('Checking road section: missionId=%s, serviceInRoadSectionId=%s, isServiceIn=%s',
        missionId or 'nil', serviceInRoadSectionId or 'nil', tostring(isServiceInRoadSection)))
      else
        log('W', logTag, 'applyTrafficExclusion: Mission not found: ' .. tostring(missionId))
      end
@/lua/common/utils/pixellib.lua
function LuaPixelBuffer:__tostring()
    return 'LuaPixelBuffer - ' .. tostring(self.buf) .. ' [resolution: ' .. self.width .. ' x ' .. self.height .. ' (RGBA)]'
end
  pb:init(250, 250)
  print(tostring(pb))
@/lua/ge/extensions/gameplay/sites/customFields.lua
    if data.types[name] == 'string' then
      self:add(name,'string',tostring(data.values[name]))
    elseif data.types[name] == 'number' then
@/lua/ge/extensions/gameplay/missions/progress.lua
  else
    return { text = tostring(val) }
  end
    if type(value) == 'string' or type(value) == 'number' then
      context[key] = tostring(value)
    end
@/lua/common/extensions/ui/flowgraph/editor.lua
  elseif tpe == 'string' or tpe == 'bool' or tpe == 'boolean' then
    return (tostring(value):sub(0, 10) .. (tostring(value):len() > 10 and "..." or ""))
  elseif tpe == 'number' then
  elseif tpe == 'string' or tpe == 'bool' or tpe == 'boolean' then
    return (tostring(value):sub(0, 10) .. (tostring(value):len() > 10 and "..." or ""))
  elseif tpe == 'number' then
  elseif tpe == 'string' or tpe == 'bool' then
    return (tostring(value))
  elseif tpe == 'number' then
  if not variable then
    im.Text("Variable " .. tostring(name) .. " not found!")
    return
          im.SameLine()
          im.Text(tostring(variable.type))
        end
    if self.modelName and self.modelName ~= "" then
      im.Text(tostring(self.modelName))
    elseif self.model and self.model ~= "" then
    elseif self.model and self.model ~= "" then
      im.Text(tostring(self.model))
    else
    else
      im.Text(tostring("No Model Selected"))
    end
      if self.configName and self.configName ~= "" then
        im.Text(tostring(self.configName))
      elseif self.config and self.config ~= "" then
      elseif self.config and self.config ~= "" then
        im.Text(tostring(self.config))
      else
      else
        im.Text(tostring("No Config Selected"))
      end
@/lua/ge/extensions/scenario/quickRace.lua
    if not json then
      log('E',nil, 'could not read race file for time trials: ' .. tostring(file))
    else
@/lua/ge/extensions/scenario/scenariohelper.lua
  local resetLearning = arg.resetLearning and 'true' or 'false'
  queueLuaCommandByName(vehicleName, 'ai.driveUsingPath({wpTargetList = '..serialize(waypoints)..', routeSpeed = '..routeSpeed..', routeSpeedMode = "'..routeSpeedMode..'", driveInLane = "'..driveInLane..'", wpSpeeds = '..serialize(speeds)..', noOfLaps = '..lapCount..', aggression = '..aggression..', aggressionMode = "'..aggressionMode..'", resetLearning = '..resetLearning..', avoidCars = "'..tostring(avoidCars)..'"})')
@/lua/ge/extensions/gameplay/rally/notebook/structured/libCompositor.lua
local function getCornerCall(config, cornerSeverity, cornerDirection, cornerSquare)
  -- log('D', '', 'cornerSeverity=' .. tostring(cornerSeverity) .. ' cornerDirection=' .. tostring(cornerDirection) .. ' cornerSquare=' .. tostring(cornerSquare))
  if cornerDirection == 0 then
local function getCornerCall(config, cornerSeverity, cornerDirection, cornerSquare)
  -- log('D', '', 'cornerSeverity=' .. tostring(cornerSeverity) .. ' cornerDirection=' .. tostring(cornerDirection) .. ' cornerSquare=' .. tostring(cornerSquare))
  if cornerDirection == 0 then
local function getCornerCall(config, cornerSeverity, cornerDirection, cornerSquare)
  -- log('D', '', 'cornerSeverity=' .. tostring(cornerSeverity) .. ' cornerDirection=' .. tostring(cornerDirection) .. ' cornerSquare=' .. tostring(cornerSquare))
  if cornerDirection == 0 then
  if not targetNum or targetNum < 0 then
    log('E', 'Invalid corner severity: ' .. tostring(cornerSeverity))
    return nil, nil
            elseif cornerDirection ~= 0 then
              log('E', '', 'No corner phrase found for square=' .. tostring(cornerSquare) .. ' ' .. cornerDirection .. ' ' .. cornerLength.value .. ' ' .. cornerRadiusChange.value)
            end
@/lua/ge/extensions/editor/terrainMaterialsEditor.lua
  editor.uiInputText(
    "##" .. propertyName .. tostring(0),
    editor.getTempCharPtr(terrainMtlCopyProxy.material:getField(propertyName, 0)),
          for k, v in ipairs(upgradeFileFormatMaterials.terrainMaterials) do
            im.TextUnformatted(tostring(v.id))
            im.TableNextColumn()
@/gameplay/missionTypes/scatterPickup/customNodes/scatterPrefabSetupNode.lua
      -- name will be generated to avoid duplicate names
      local name = "spawnedObj_" .. tostring(os.time()) .. "_" .. self.id..'_'.. #self.objectIds
      object:registerObject(name)
@/lua/ge/extensions/c2/panelPlugins/vehicleManager.lua
    }
    log('I', 'vehicleManager', 'Subscribed peer ' .. tostring(event.peerId) .. ' to player data')
  elseif msg.type == 'subscribeAllVehicles' then
    }
    log('I', 'vehicleManager', 'Subscribed peer ' .. tostring(event.peerId) .. ' to all vehicles')
  elseif msg.type == 'unsubscribePlayer' then
    subscribers[event.peerId] = nil
    log('I', 'vehicleManager', 'Unsubscribed peer ' .. tostring(event.peerId) .. ' from vehicle data')
  end
@/lua/ge/extensions/editor/trafficManager.lua
          if session.vehicles[nameId] then
            local str = "["..tostring(vehId).."] "..veh.jbeam
          for _, id in ipairs(currInstance.tempSignalObjects) do
            if im.Button(tostring(id).."##signalObject", im.ImVec2(columnWidth - im.GetStyle().ItemSpacing.x, 20 * im.uiscale[0])) then
              editor.clearObjectSelection()
    if data.level ~= getCurrentLevelIdentifier() then -- checks if the level from the data matches the current level
      editor.showNotification("Warning, level mismatch from data ("..tostring(data.level)..").", nil, nil, 10)
      log("W", logTag, "Wrong level! Expected: "..tostring(data.level)..", Actual: "..tostring(getCurrentLevelIdentifier()))
      editor.showNotification("Warning, level mismatch from data ("..tostring(data.level)..").", nil, nil, 10)
      log("W", logTag, "Wrong level! Expected: "..tostring(data.level)..", Actual: "..tostring(getCurrentLevelIdentifier()))
    else
      editor.showNotification("Warning, level mismatch from data ("..tostring(data.level)..").", nil, nil, 10)
      log("W", logTag, "Wrong level! Expected: "..tostring(data.level)..", Actual: "..tostring(getCurrentLevelIdentifier()))
    else

      obj:setName(prefix..tostring(id)) -- try to make this a unique name
      group:addObject(obj)
@/lua/ge/extensions/util/wsTest.lua
  server, chosenAddress = wsUtils.createOrGetWS('any', port, './ui/entrypoints/util_wsTest/', protocolName, '/ui/entrypoints/util_wsTest/index.html')
  print('wsTest webserver running at: http://' .. chosenAddress .. ':' .. tostring(port) .. ' (listening on all addresses)')
  --openWebBrowser('http://' .. chosenAddress .. ':'.. tostring(port))
  print('wsTest webserver running at: http://' .. chosenAddress .. ':' .. tostring(port) .. ' (listening on all addresses)')
  --openWebBrowser('http://' .. chosenAddress .. ':'.. tostring(port))
end
    end
    --server:sendData(e.peerId, "got data: " .. e.type .. ' / ' .. tostring(e.msg) .. ' / you are client: ' .. tostring(e.peerId))
  end
    end
    --server:sendData(e.peerId, "got data: " .. e.type .. ' / ' .. tostring(e.msg) .. ' / you are client: ' .. tostring(e.peerId))
  end
@/lua/ge/extensions/editor/sensorConfigurationEditor.lua
        -- Handle the individual row selection.
        local vName = tostring(vehicle.vid .. ": " .. vehicle.name .. " - " .. vehicle.jBeam)
        if im.Selectable1(vName, i == selectedVehicleIdx, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
        im.PushItemWidth(130)
        im.InputFloat("[X-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the X-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Y-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Y-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Z-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Z-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputInt("Horizontal Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the horizontal resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputInt("Vertical Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the vertical resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputFloat("Field Of View ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip('Set the field of view of the sensor.')
        im.PushItemWidth(130)
        im.InputFloat("Near Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the near plane distance of the sensor (min depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Far Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the far plane distance of the sensor (max depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Sensor Refresh Rate ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f s")
        im.tooltip('Set the time between sensor updates.')
        im.PushItemWidth(130)
        im.InputFloat("[X-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the X-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Y-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Y-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Z-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Z-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputInt("Vertical Resolution ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the number of vertical resolution levels.')
        im.PushItemWidth(130)
        im.InputFloat("Vertical Field Of View ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip('Set the vertical field of view, in degrees.')
        im.PushItemWidth(130)
        im.InputFloat("Horizontal Field Of View ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip('Set the horizontal field of view, in degrees.')
        im.PushItemWidth(130)
        im.InputInt("Rotation Frequency (Hz) ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the rotation frequency, in Hz.')
        im.PushItemWidth(130)
        im.InputFloat("Max Detection Range ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the sensor maximum detection range, in meters.')
        im.PushItemWidth(130)
        im.InputFloat("Sensor Refresh Rate ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f s")
        im.tooltip('Set the time between sensor updates.')
        im.PushItemWidth(130)
        im.InputFloat("[X-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the X-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Y-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Y-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Z-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Z-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputInt("Horizontal Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the horizontal resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputInt("Vertical Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the vertical resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputFloat("Field Of View ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip('Set the field of view of the sensor.')
        im.PushItemWidth(130)
        im.InputFloat("Near Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the near plane distance of the sensor (min depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Far Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the far plane distance of the sensor (max depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Range Roundness ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip("Set the 'roundness' of the beam shape.")
        im.PushItemWidth(130)
        im.InputFloat("Range Cutoff Sensitivity ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the sensitivity of the range cutoff.')
        im.PushItemWidth(130)
        im.InputFloat("Range Shape ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the shape across the beam range.')
        im.PushItemWidth(130)
        im.InputFloat("Range Focus ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the sharpness of the shape across the beam range.')
        im.PushItemWidth(130)
        im.InputFloat("Range Min Cutoff ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f m")
        im.tooltip('Set the near plane, in meters.')
        im.PushItemWidth(130)
        im.InputFloat("Range Direct Max Cutoff ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f m")
        im.tooltip('Set the far plane, in meters.')
        im.PushItemWidth(130)
        im.InputFloat("Sensitivity ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f")
        im.tooltip("Set the detection sensitivity.")
        im.PushItemWidth(130)
        im.InputInt("Window Width ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the width of the window used in processing the returns.')
        im.PushItemWidth(130)
        im.InputFloat("Sensor Refresh Rate ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f s")
        im.tooltip('Set the time between sensor updates.')
        im.PushItemWidth(130)
        im.InputFloat("[X-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the X-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Y-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Y-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Z-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Z-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputInt("Horizontal Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the horizontal resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputInt("Vertical Resolution ###" .. tostring(ctr), uiVal, 10, nil)
        im.tooltip('Set the vertical resolution of the sensor, in pixels.')
        im.PushItemWidth(130)
        im.InputFloat("Field Of View ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip('Set the field of view of the sensor.')
        im.PushItemWidth(130)
        im.InputFloat("Near Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the near plane distance of the sensor (min depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Far Plane Distance ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f m")
        im.tooltip('Set the far plane distance of the sensor (max depth cutoff).')
        im.PushItemWidth(130)
        im.InputFloat("Range Roundness ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip("Set the 'roundness' of the beam shape.")
        im.PushItemWidth(130)
        im.InputFloat("Range Cutoff Sensitivity ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the sensitivity of the range cutoff.')
        im.PushItemWidth(130)
        im.InputFloat("Range Shape ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the shape across the beam range.')
        im.PushItemWidth(130)
        im.InputFloat("Range Focus ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f")
        im.tooltip('Set the sharpness of the shape across the beam range.')
        im.PushItemWidth(130)
        im.InputFloat("Range Min Cutoff ###" .. tostring(ctr), uiVal, 0.1, nil, "%.4f m")
        im.tooltip('Set the near plane, in meters.')
        im.PushItemWidth(130)
        im.InputFloat("Range Direct Max Cutoff ###" .. tostring(ctr), uiVal, 1.0, nil, "%.4f m")
        im.tooltip('Set the far plane, in meters.')
        im.PushItemWidth(130)
        im.InputInt("Range Bins ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the number of bins to divide the data into, in the range dimension.')
        im.PushItemWidth(130)
        im.InputInt("Azimuth Bins ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the number of bins to divide the data into, in the azimuth dimension.')
        im.PushItemWidth(130)
        im.InputInt("Velocity Bins ###" .. tostring(ctr), uiVal, 1, nil)
        im.tooltip('Set the number of bins to divide the data into, in the velocity dimension.')
        im.PushItemWidth(130)
        im.InputFloat("Min Range ###" .. tostring(ctr), uiVal, 1, nil, "%.2f")
        im.tooltip("Set the minimum range to display in the data.")
        im.PushItemWidth(130)
        im.InputFloat("Max Range ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f")
        im.tooltip("Set the maximum range to display in the data.")
        im.PushItemWidth(130)
        im.InputFloat("Min Velocity ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f")
        im.tooltip("Set the minimum velocity to display in the data.")
        im.PushItemWidth(130)
        im.InputFloat("Max Velocity ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f")
        im.tooltip("Set the maximum velocity to display in the data.")
        im.PushItemWidth(130)
        im.InputFloat("Azimuth Half-Angle ###" .. tostring(ctr), uiVal, 1.0, nil, "%.2f deg")
        im.tooltip("Set the azimuth half-angle, used in data display.")
        im.PushItemWidth(130)
        im.InputFloat("Sensor Refresh Rate ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f s")
        im.tooltip('Set the time between sensor updates.')
        im.PushItemWidth(130)
        im.InputFloat("[X-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the X-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Y-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Y-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Z-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Z-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[X-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the X-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Y-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Y-Axis, relative to vehicle center.')
        im.PushItemWidth(130)
        im.InputFloat("[Z-Axis] ###" .. tostring(ctr), uiVal, 0.01, nil, "%.4f m")
        im.tooltip('Set the sensor position on the Z-Axis, relative to vehicle center.')
@/lua/ge/extensions/editor/audioRibbonEditor.lua
    persistantId = ribbonId,
    name = 'New Ribbon ' .. tostring(#ribbons + 1),
    isVisible = false,
        local ribbon = ribbons[i]
        if im.Selectable1('###' .. tostring(i), i == selectedRibbonIdx, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
          if i ~= selectedRibbonIdx then
        if ribbon.isEnabled then
          im.InputText("###100" .. tostring(i), nameBinding, 128)
          ribbon.name = ffi.string(nameBinding)
@/lua/ge/extensions/core/commandhandler.lua
local function onSchemeCommand(scheme, isStartingArg)
  log('D', logTag, 'new scheme command: ' .. tostring(scheme))
  if not uiReady then

  log('D', 'scheme', "invoked by scheme: " .. tostring(scheme) .. ' = ' .. dumps(args))
    filename = filename[#filename]
    log('I', logTag, 'show mod: ' .. tostring(data))
    extensions.core_repository.uiShowMod(data)
    filename = filename[#filename]
    log('I', logTag, 'subscription mod: ' .. tostring(data))
    extensions.core_repository.uiShowRepo()
    filename = filename[#filename]
    log('I', logTag, 'downloading mod: ' .. tostring(data))
    extensions.core_repository.installMod(data, filename, 'mods/repo/')
    end
    log('I', logTag, "updateZipMod '" .. tostring(tmp[1]).. "' with new '"..tostring(tmp[2]) .."'")
    extensions.core_modmanager.updateZipMod(tmp[1], tmp[2])
    end
    log('I', logTag, "updateZipMod '" .. tostring(tmp[1]).. "' with new '"..tostring(tmp[2]) .."'")
    extensions.core_modmanager.updateZipMod(tmp[1], tmp[2])
      else
        log('E', logTag, 'unknown scheme: ' ..tostring(arg1))
      end
@/lua/common/jbeam/sectionMerger.lua
    if vehicle[sectionNameTarget][k] then
      log('W', 'overwriting row: ' .. tostring(k) .. ' from section ' .. tostring(sectionNameTarget) .. ' into section ' .. tostring(sectionNameTarget))
    end
    if vehicle[sectionNameTarget][k] then
      log('W', 'overwriting row: ' .. tostring(k) .. ' from section ' .. tostring(sectionNameTarget) .. ' into section ' .. tostring(sectionNameTarget))
    end
    if vehicle[sectionNameTarget][k] then
      log('W', 'overwriting row: ' .. tostring(k) .. ' from section ' .. tostring(sectionNameTarget) .. ' into section ' .. tostring(sectionNameTarget))
    end
@/lua/ge/extensions/core/hardwareinfo.lua
    end
    log('D', 'hardwareinfo.disk', ' originalSize='..tostring(originalSize).."   rootsize="..tostring(rootsize) )
    if sailingTheHighSeas or (rootsize and (originalSize - 10485760 > rootsize or rootsize > originalSize + 268435456)) then -- allow a size difference of -100mb and +256mb because of `_CommonRedist`
    end
    log('D', 'hardwareinfo.disk', ' originalSize='..tostring(originalSize).."   rootsize="..tostring(rootsize) )
    if sailingTheHighSeas or (rootsize and (originalSize - 10485760 > rootsize or rootsize > originalSize + 268435456)) then -- allow a size difference of -100mb and +256mb because of `_CommonRedist`
        for k2,v2 in pairs(v.warnings) do
          if settings.getValue('PerformanceWarnings.' .. tostring(v2.msg)) then
            v2.ack = true
  -- this is called once the banchmark is done
  log('D', 'hardwareinfo.onBananaBenchReady', 'onBananaBenchReady: ' .. tostring(outFilename))
  if not FS:fileExists(outFilename) then
@/lua/ge/extensions/editor/crawlEditor/paths.lua
  local node = {
    name = "Node " .. tostring(#path.nodes + 1),
    pos = vec3(0, 0, 0),
@/lua/ge/extensions/editor/vehicleDetailViewer.lua
local function renderPopup(view)
  if im.BeginMenu('View##VDV_'..tostring(view.name)) then
    if im.RadioButton1('Left##VDV_'..tostring(view.name), view.typeName == 'Left') then
  if im.BeginMenu('View##VDV_'..tostring(view.name)) then
    if im.RadioButton1('Left##VDV_'..tostring(view.name), view.typeName == 'Left') then
      tableMerge(view, viewTemplates.left)
    end
    if im.RadioButton1('Right##VDV_'..tostring(view.name), view.typeName == 'Right') then
      tableMerge(view, viewTemplates.right)
    end
    if im.RadioButton1('Top##VDV_'..tostring(view.name), view.typeName == 'Top') then
      tableMerge(view, viewTemplates.top)
    end
    if im.RadioButton1('Bottom##VDV_'..tostring(view.name), view.typeName == 'Bottom') then
      tableMerge(view, viewTemplates.bottom)
    end
    if im.RadioButton1('Front##VDV_'..tostring(view.name), view.typeName == 'Front') then
      tableMerge(view, viewTemplates.front)
    end
    if im.RadioButton1('Back##VDV_'..tostring(view.name), view.typeName == 'Back') then
      tableMerge(view, viewTemplates.back)
    im.Separator()
    if im.Selectable1('New##VDV_'..tostring(view.name)) then
      spawnNewView = true
    end
    if im.Selectable1('Close##VDV_'..tostring(view.name)) then
      view.windowOpen[0] = false

  if im.Selectable1('save as PNG##save'..tostring(view.name)) then
    local filename = view.name .. '-' .. tostring(loadedLayoutBaseFilename) .. '.png'
  if im.Selectable1('save as PNG##save'..tostring(view.name)) then
    local filename = view.name .. '-' .. tostring(loadedLayoutBaseFilename) .. '.png'
    view.runtime.rv:saveToDisk(filename)
    view.runtime.rv:saveToDisk(filename)
    log('I', 'thumbnail', 'saved to disk: ' .. tostring(filename))
    view.statusMessage = 'image saved: ' .. tostring(filename)
    log('I', 'thumbnail', 'saved to disk: ' .. tostring(filename))
    view.statusMessage = 'image saved: ' .. tostring(filename)
  end
  if not view.debugBoolPtr then view.debugBoolPtr = im.BoolPtr(view.debug or false) end
  if im.Checkbox('Debug##VDV_'..tostring(view.name), view.debugBoolPtr) then
    view.debug = view.debugBoolPtr[0]
  if not view.fixUpAxisBoolPtr then view.fixUpAxisBoolPtr = im.BoolPtr(view.fixUpAxis or false) end
  if im.Checkbox('World Up Axis##VDV_'..tostring(view.name), view.fixUpAxisBoolPtr) then
    view.fixUpAxis = view.fixUpAxisBoolPtr[0]
  if not view.freezeBoolPtr then view.freezeBoolPtr = im.BoolPtr(view.freeze or false) end
  if im.Checkbox('Freeze Camera##VDV_'..tostring(view.name), view.freezeBoolPtr) then
    view.freeze = view.freezeBoolPtr[0]
  im.Separator()
  if im.BeginMenu('View details##VDV_'..tostring(view.name)) then -- there is only one at any point in time
    im.TextUnformatted('Name: ' .. tostring(view.name))
  if im.BeginMenu('View details##VDV_'..tostring(view.name)) then -- there is only one at any point in time
    im.TextUnformatted('Name: ' .. tostring(view.name))
    im.TextUnformatted('Zoom: ' .. tostring(customRound(view.zoom, 4)))
    im.TextUnformatted('Name: ' .. tostring(view.name))
    im.TextUnformatted('Zoom: ' .. tostring(customRound(view.zoom, 4)))
    im.TextUnformatted('Offset: ' ..tostring(customRound(view.dragOffset.x, 4)) .. ', ' .. tostring(customRound(view.dragOffset.y, 4)))
    im.TextUnformatted('Zoom: ' .. tostring(customRound(view.zoom, 4)))
    im.TextUnformatted('Offset: ' ..tostring(customRound(view.dragOffset.x, 4)) .. ', ' .. tostring(customRound(view.dragOffset.y, 4)))
    im.TextUnformatted('Nearclip: ' .. tostring(customRound(view.nearClip, 4)))
    im.TextUnformatted('Zoom: ' .. tostring(customRound(view.zoom, 4)))
    im.TextUnformatted('Offset: ' ..tostring(customRound(view.dragOffset.x, 4)) .. ', ' .. tostring(customRound(view.dragOffset.y, 4)))
    im.TextUnformatted('Nearclip: ' .. tostring(customRound(view.nearClip, 4)))
    im.TextUnformatted('Offset: ' ..tostring(customRound(view.dragOffset.x, 4)) .. ', ' .. tostring(customRound(view.dragOffset.y, 4)))
    im.TextUnformatted('Nearclip: ' .. tostring(customRound(view.nearClip, 4)))
    im.TextUnformatted('Resolution: ' .. tostring(math.floor(view.size.x)) .. 'x' .. tostring(math.floor(view.size.y)))
    im.TextUnformatted('Nearclip: ' .. tostring(customRound(view.nearClip, 4)))
    im.TextUnformatted('Resolution: ' .. tostring(math.floor(view.size.x)) .. 'x' .. tostring(math.floor(view.size.y)))
    im.EndMenu()
    im.TextUnformatted('Nearclip: ' .. tostring(customRound(view.nearClip, 4)))
    im.TextUnformatted('Resolution: ' .. tostring(math.floor(view.size.x)) .. 'x' .. tostring(math.floor(view.size.y)))
    im.EndMenu()

  if im.BeginMenu('View Controls##VDV_'..tostring(view.name)) then
    im.PushStyleColor2(im.Col_Text, im.ImVec4(1, 1, 1, 0.8))

  if im.BeginMenu('Layouts##VDV_'..tostring(view.name)) then
    if im.SmallButton('reset current##resetLayouy') then
        im.SetCursorPosX(200)
        if im.SmallButton('load##loadLayouy_'..tostring(lidx)) then
          loadedLayoutBaseFilename = baseFilename
        im.SameLine()
        if im.SmallButton('overwrite##overwriteLayouy_'..tostring(lidx)) then
          jsonWriteFile(layoutFilename, onSerialize())
        im.SameLine()
        if im.SmallButton('delete##deleteLayouy_'..tostring(lidx)) then
          FS:removeFile(layoutFilename)
  --  float_v_speed, int_v_min, int_v_max, string_format, ImGuiSliderFlags_flags
  if im.BeginMenu('Options##VDV_'..tostring(view.name)) then
    im.TextUnformatted('Image resolution multiplier: ')
  im.SetCursorPosX(5)
  im.TextUnformatted('Nearclip: ' .. tostring(customRound(view.nearClip, 6)))
    local newView = deepcopy(viewTemplates.left)
    newView.name = 'View ' .. tostring(#views + 1)
    newView.windowOpen = im.BoolPtr(true)
@/lua/ge/extensions/gameplay/crawl/flowgraphBridge.lua
  if not trail then
    log('E', logTag, 'Failed to load trail: ' .. tostring(trailId))
    return nil
@/lua/common/jbeam/io.lua
    -- backward compatibility: some parts miss the table header, which worked due to limitations before.
    log('W', 'slotSystem', 'Slot section of part ' .. tostring(part.partName) .. ' in file ' .. tostring(sourceFilename) ..' misses the table header. Adding default: ["type", "default", "description"]. Please fix.')
    tableInsert(part.slots, 1, {"type", "default", "description"})
    -- backward compatibility: some parts miss the table header, which worked due to limitations before.
    log('W', 'slotSystem', 'Slot section of part ' .. tostring(part.partName) .. ' in file ' .. tostring(sourceFilename) ..' misses the table header. Adding default: ["type", "default", "description"]. Please fix.')
    tableInsert(part.slots, 1, {"type", "default", "description"})
    if newListSize < 0 then
      log('E', "", "Slots section in file " .. tostring(sourceFilename) .. " invalid. Unable to recover: " .. dumpsz(part.slots, 2))
    else
    else
      log('W', "", "Slots section in file " .. tostring(sourceFilename) .. " invalid. Please fix. Partly reconstructed: " .. dumpsz(part.slots, 2))
    end
local function processSlotsDestructive(part, sourceFilename)
  --log('I', "", "Processing slots in file " .. tostring(sourceFilename) .. " ..." .. dumpsz(part, 2))
  if type(part.slots) ~= 'table' and type(part.slots2) ~= 'table' then return nil end
    if newListSize < 0 then
      log('E', "", "Slots section in file " .. tostring(sourceFilename) .. " invalid. Unable to recover: " .. dumpsz(part.slots2, 2))
    end
    end
    --log('I', "", "Slots section in file " .. tostring(sourceFilename) .. " processed: " .. dumpsz(newSlots2, 2))
    part.slots2 = newSlots2
    if ok == false then
      log('E', "jbeam.parseFile","unable to decode JSON: "..tostring(filename))
      log('E', "jbeam.parseFile","JSON decoding error: "..tostring(data))
      log('E', "jbeam.parseFile","unable to decode JSON: "..tostring(filename))
      log('E', "jbeam.parseFile","JSON decoding error: "..tostring(data))
      return nil
      if type(part.slotType) ~= 'string' and type(part.slotType) ~= 'table' then
        log('E', "jbeam.loadJBeamFile", "part does not have a slot type. Ignoring: "..tostring(filename) .. ' - ' .. dumpsz(part, 2))
        parts[partName].slotTypes = {}
  else
    log('E', "jbeam.parseFile","unable to read file: "..tostring(filename))
  end
        if tableContains(partSlotMap[cacheData.namespace][slotType], partName) then
          log('E', 'jbeam.loadJBeamFile', 'Duplicate part found: ' .. tostring(partName) .. ' from file ' .. tostring(filename))
        end
        if tableContains(partSlotMap[cacheData.namespace][slotType], partName) then
          log('E', 'jbeam.loadJBeamFile', 'Duplicate part found: ' .. tostring(partName) .. ' from file ' .. tostring(filename))
        end
    end
    log('D', 'jbeam.startLoading', "Loaded " .. tostring(partCountTotal) .. " parts from " .. tostring(tableSize(jbeamCache)) .. ' jbeam files in ' .. tostring(dir))
  end
    end
    log('D', 'jbeam.startLoading', "Loaded " .. tostring(partCountTotal) .. " parts from " .. tostring(tableSize(jbeamCache)) .. ' jbeam files in ' .. tostring(dir))
  end
    end
    log('D', 'jbeam.startLoading', "Loaded " .. tostring(partCountTotal) .. " parts from " .. tostring(tableSize(jbeamCache)) .. ' jbeam files in ' .. tostring(dir))
  end
      if res[partName] then
        log('E', "jbeam.getAvailableParts", "parts names are duplicate: " .. tostring(partName) .. ' in folders: ' .. dumps(ioCtx.preloadedDirs))
      end
        if partMap[partName] then
          log('E', "jbeam.getAvailableSlotNameMap", "parts names are duplicate: " .. tostring(partName) .. ' in folders: ' .. dumps(ioCtx.preloadedDirs))
        end
          else
            log("E", "jbeam.getCompatiblePartNamesForSlot", "Part \"" .. tostring(partName) .. "\" not found; skipping.")
          end
  if fileCache[filename] then
    log('I', 'jbeam.onFileChanged', 'File changed: ' .. tostring(filename) .. ' (' .. tostring(type) .. ')')
  end
  if fileCache[filename] then
    log('I', 'jbeam.onFileChanged', 'File changed: ' .. tostring(filename) .. ' (' .. tostring(type) .. ')')
  end
@/lua/common/particles.lua

    --log('W', "particles.getMaterialIDByName", "unknown material: " .. tostring(s))
    -- creating temp definition
            if v[kc] ~= "" then
                --print("kc: "..tostring(kc) .. " / " .. v[kc])
                local s = ""
            log('W', "particles.getMaterialsParticlesTable", "### " .. compareFuncStr)
            log('W', "particles.getMaterialsParticlesTable", "### " .. tostring(err))
        end

        print("###"..compareFuncStr.. " = " .. tostring(v.compareFunc(p)).."")
        ]]--
@/lua/ge/extensions/ui/vehicleSelector/vehicleOperations.lua
  else
    log("E", "", "Button function not found for ID: " .. tostring(buttonId))
  end
    if vehicle then
      log("I", "", "Vehicle spawned: " .. tostring(modelKey) .. " (ID: " .. tostring(vehicle:getId()) .. ")")
      --ui_fadeScreen.stop(fadeScreenDuration)
    if vehicle then
      log("I", "", "Vehicle spawned: " .. tostring(modelKey) .. " (ID: " .. tostring(vehicle:getId()) .. ")")
      --ui_fadeScreen.stop(fadeScreenDuration)
    else
      log("E", "", "Failed to spawn vehicle: " .. tostring(modelKey))
      --ui_fadeScreen.stop(fadeScreenDuration)
    if vehicle then
      log("I", "", "Vehicle replaced: " .. tostring(modelKey) .. " (ID: " .. tostring(vehicle:getId()) .. ")")
      --ui_fadeScreen.stop(fadeScreenDuration)
    if vehicle then
      log("I", "", "Vehicle replaced: " .. tostring(modelKey) .. " (ID: " .. tostring(vehicle:getId()) .. ")")
      --ui_fadeScreen.stop(fadeScreenDuration)
    else
      log("E", "", "Failed to replace vehicle: " .. tostring(modelKey))
      --ui_fadeScreen.stop(fadeScreenDuration)
    if vehicle then
      log("I", "", "Vehicle cloned: (ID: " .. tostring(vehicle:getId()) .. ")")
      --ui_fadeScreen.stop(fadeScreenDuration)
@/lua/ge/extensions/editor/sidewalkSpline.lua
          local flag = i == selectedSplineIdx
          if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            selectedSplineIdx = i
          else
            if im.InputText("###" .. tostring(wCtr), splineNamePtr, 32) then
              spline.name = ffi.string(splineNamePtr)
              tmpPtr = im.BoolPtr(isEnabled)
              if im.Checkbox("###piece_" .. tostring(pieceIndex), tmpPtr) then
                preState = splineMgr.deepCopySidewalkSpline(selSpline)
                  local varTmpPtr = im.BoolPtr(varEnabled)
                  if im.Checkbox("###pieceVar_" .. tostring(pieceIndex) .. "_" .. tostring(j), varTmpPtr) then
                    preState = splineMgr.deepCopySidewalkSpline(selSpline)
                  local varTmpPtr = im.BoolPtr(varEnabled)
                  if im.Checkbox("###pieceVar_" .. tostring(pieceIndex) .. "_" .. tostring(j), varTmpPtr) then
                    preState = splineMgr.deepCopySidewalkSpline(selSpline)
                  -- Variation number.
                  im.TextColored(cols.dullWhite, "var" .. tostring(j))
                  im.tooltip("This is variation " .. tostring(j) .. " of the base component.")
                  im.TextColored(cols.dullWhite, "var" .. tostring(j))
                  im.tooltip("This is variation " .. tostring(j) .. " of the base component.")
                  im.NextColumn()
                im.Columns(2, "DistributionCols" .. pieceIndex, false)
                if im.RadioButton2("Round Robin###dist" .. tostring(pieceIndex) .. "_0", tmpPtr, 0) then
                  local statePre = splineMgr.deepCopySidewalkSpline(selSpline)
                im.NextColumn()
                if im.RadioButton2("Random###dist" .. tostring(pieceIndex) .. "_1", tmpPtr, 1) then
                  local statePre = splineMgr.deepCopySidewalkSpline(selSpline)
                        end
                        im.tooltip("Set the weight for variation " .. tostring(j) .. ".")
                        if im.IsItemActivated() then
@/lua/ge/extensions/editor/roadEditor.lua
    if nodeID == 0 or nodeID == road:getNodeCount() - 1 then
      editor.logError("Can't split at the end of road "..tostring(road:getID()))
      return
      if im.Checkbox("Use Template", useTemplate) then
        editor.setDynamicFieldValue(selectedRoad:getID(), "useTemplate", tostring(useTemplate[0]))
      end
    for tagId = 0, 2 do
      local tag = material:getField("materialTag", tostring(tagId))
      if string.lower(tag) == string.lower(roadMaterialTagString) then
@/lua/ge/extensions/core/cameraModes/relative.lua
      end
      --print("new light brightness mode: " .. tostring(self.lightBrightness))
      self:_updateLight()
    for i = 1, 10 do
      local tmp = { title = tostring(i), iconName = 'movieCamera', priority = i, onSelect = function()
        if self.slots[i] == nil then
  }
  ui_message('Camera position stored in slot ' .. tostring(slot), 10, 'cameramode')
end
  if type(slot) == 'string' then
    --print(">> slot " .. tostring(slot) .. " is ID " .. tostring(self.slotNameIndexMap[slot]))
    slot = self.slotNameIndexMap[slot] -- convert name to ID
  if type(slot) == 'string' then
    --print(">> slot " .. tostring(slot) .. " is ID " .. tostring(self.slotNameIndexMap[slot]))
    slot = self.slotNameIndexMap[slot] -- convert name to ID
  if not self.slots[slot] then
    ui_message('Slot ' .. tostring(slot) .. ' empty'  , 10, 'cameramode')
    return false
@/lua/ge/extensions/freeroam/specialTriggers.lua
    if M.debugMode then
      log('D', logTag, 'Updated state of '..name..': '..tostring(active))
    end
  local data = triggers[tName]
  if active == nil then active = not data.active print(tostring(active)) end
  data.triggerName = tName
@/lua/console/bananabench-xml.lua
          --if l.level then
            --t = t .. tostring(l.level) .. '|' .. tostring(l.origin) .. '|' .. tostring(l.msg)
            --if l.newline then
          --if l.level then
            --t = t .. tostring(l.level) .. '|' .. tostring(l.origin) .. '|' .. tostring(l.msg)
            --if l.newline then
          --if l.level then
            --t = t .. tostring(l.level) .. '|' .. tostring(l.origin) .. '|' .. tostring(l.msg)
            --if l.newline then
@/lua/ge/extensions/editor/drivePathEditor.lua
          local flag = i == selectedSplineIdx
          if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            selectedSplineIdx = i
          else
            if im.InputText("###" .. tostring(wCtr), splineNamePtr, 32) then
              spline.name = ffi.string(splineNamePtr)
          local flag = i == selectedVehicleIdx
          if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            selectedVehicleIdx = i
@/lua/ge/extensions/core/windowsConsole.lua
  extensions.hook('onConsoleExecuteCommand', context, cmd)
  --log('D', 'winConsole', 'executeCommand: ' .. tostring(context) .. ' - ' .. tostring(cmd))
  if context == 'GE-Lua' then
  extensions.hook('onConsoleExecuteCommand', context, cmd)
  --log('D', 'winConsole', 'executeCommand: ' .. tostring(context) .. ' - ' .. tostring(cmd))
  if context == 'GE-Lua' then
@/lua/ge/extensions/flowgraph/graph.lua
  if not lookup[nodeType] then
    log('E', 'flowgraph_graph.createNode', 'unable to find node type: "' .. tostring(nodeType) .. '". Available types: ' .. dumps(tableKeys(lookup)))
    return
      else
        log('E', self.mgr.logTag, 'targetNode node not found: ' .. tostring(linkData[3]))
      end
    else
      log('E', self.mgr.logTag, 'Source node not found: ' .. tostring(linkData[1]))
    end
@/lua/ge/extensions/editor/flowgraph/main.lua
    if not status then
      log('E', 'node.'..tostring('drawGraph'), tostring(err))
      node:__setNodeError('work', 'Error while executing node:_drawMiddle(): ' .. tostring(err))
    if not status then
      log('E', 'node.'..tostring('drawGraph'), tostring(err))
      node:__setNodeError('work', 'Error while executing node:_drawMiddle(): ' .. tostring(err))
      log('E', 'node.'..tostring('drawGraph'), tostring(err))
      node:__setNodeError('work', 'Error while executing node:_drawMiddle(): ' .. tostring(err))
    end
@/lua/common/json-ast.lua
    --dump{num_str, num}
    log('E', '', 'failed to parse number at position ' .. tostring(ctx.pos))
    return
        if ctx.transient.root then
          log('E', '', 'Multiple root nodes not allowed. Type: ' .. tostring(node[1]))
          return false
    if posSaved == ctx.pos then
      log('E', '', 'using fallback literal: ' .. chr .. ' at position ' .. tostring(ctx.pos))
      _addNode(ctx, {'literal', chr})
  elseif nodeType == 'bool' then
    return tostring(node[2])
  elseif nodeType == 'key_delimiter' then
    if line ~= linesB[i] then
      log('E', 'Difference found: ' .. tostring(filename) .. ' - line ' .. tostring(i) .. '\nORG: '.. tostring(line) .. '\nRES: ' .. tostring(linesB[i]))
      --return
    if line ~= linesB[i] then
      log('E', 'Difference found: ' .. tostring(filename) .. ' - line ' .. tostring(i) .. '\nORG: '.. tostring(line) .. '\nRES: ' .. tostring(linesB[i]))
      --return
    if line ~= linesB[i] then
      log('E', 'Difference found: ' .. tostring(filename) .. ' - line ' .. tostring(i) .. '\nORG: '.. tostring(line) .. '\nRES: ' .. tostring(linesB[i]))
      --return
    if line ~= linesB[i] then
      log('E', 'Difference found: ' .. tostring(filename) .. ' - line ' .. tostring(i) .. '\nORG: '.. tostring(line) .. '\nRES: ' .. tostring(linesB[i]))
      --return
  if not str then
    log('E', '', 'Unable to read file: ' .. tostring(filename))
    return
    jsonWriteFile(filename .. '.ast.json', res, true)
    print('wrote AST: ' .. tostring(filename .. '.ast.json'))
  end
    if not testFile(filename, writeAST) then
      log('E', '', string.format('File %04d/%04d ERROR: %s', i, fileCount, tostring(filename)))
      --return
      if reportOK then
        log('I', '', string.format('File %04d/%04d OK: %s', i, fileCount, tostring(filename)))
      end
@/lua/ge/extensions/flowgraph/nodes/ui/imgui/elemental/imBegin.lua
  end
  im.Begin((self.pinIn.title.value or "Title") ..'##'.. tostring(self.id), bPtr, flags)
  self.pinOut.wasClosed.value = not bPtr[0]
@/lua/ge/extensions/gameplay/crashTest/crashTestCountdown.lua
  if timer > 0 then
    msg = tostring(math.ceil(timer))
  end
@/lua/common/libs/xlsxlib/xlsxlib.lua
  if not col or not row then
    error("Invalid cell reference: " .. tostring(ref))
  end
    if char < 65 or char > 90 then
      error("Invalid column character in cell reference: " .. tostring(ref))
    end
  if not rowIndex then
    error("Invalid row number in cell reference: " .. tostring(ref))
  end
    if endColIndex < startColIndex then
      error("Invalid column range boundaries: " .. tostring(range))
    end
    if endRow < startRow then
      error("Invalid range boundaries: " .. tostring(range))
    end
    if not startRef or not endRef then
      error("Invalid range format: " .. tostring(range))
    end
    if endRow < startRow or endCol < startCol then
      error("Invalid range boundaries: " .. tostring(range))
    end
  else
    error("Invalid range: " .. tostring(range))
  end
                if sstIndex == nil then
                  error("Invalid shared string index: " .. tostring(cellValue) .. " at cell " .. tostring(cellRef))
                end
                if sstIndex == nil then
                  error("Invalid shared string index: " .. tostring(cellValue) .. " at cell " .. tostring(cellRef))
                end
                if cellValue == nil then
                  error("Shared string not found for index: " .. tostring(sstIndex) .. " at cell " .. tostring(cellRef))
                end
                if cellValue == nil then
                  error("Shared string not found for index: " .. tostring(sstIndex) .. " at cell " .. tostring(cellRef))
                end
@/lua/ge/extensions/flowgraph/nodes/recording/recordCamera.lua
  currentPath:registerObject("")
  local name = (self.pinIn.prefix.value or "pathCamera_") .. tostring(os.time())
  currentPath:setField("name", 0, name)
  im.Text(self.durationState)
  im.Text(tostring(#self.path))
@/lua/ge/extensions/tech/openStreetMapExporter.lua
  f:write(string.format('\t\n',
    tostring(nodesData.minlat), tostring(nodesData.minlon),
    tostring(nodesData.maxlat), tostring(nodesData.maxlon)))
  f:write(string.format('\t\n',
    tostring(nodesData.minlat), tostring(nodesData.minlon),
    tostring(nodesData.maxlat), tostring(nodesData.maxlon)))
    tostring(nodesData.minlat), tostring(nodesData.minlon),
    tostring(nodesData.maxlat), tostring(nodesData.maxlon)))
    tostring(nodesData.minlat), tostring(nodesData.minlon),
    tostring(nodesData.maxlat), tostring(nodesData.maxlon)))
    local nodeId = i + 1
    local lat = tostring(nodesData.nodes[i].x)
    local lon = tostring(nodesData.nodes[i].y)
    local lat = tostring(nodesData.nodes[i].x)
    local lon = tostring(nodesData.nodes[i].y)
    local ele = tostring(nodesData.nodes[i].z)
    local lon = tostring(nodesData.nodes[i].y)
    local ele = tostring(nodesData.nodes[i].z)
@/lua/common/libs/xlsxlib/tests/tests.lua
    writeFile(fn, content)
    log('W', '', 'Wrote test output for the first time, please check the results: ' .. tostring(fn))
  end
@/lua/ge/extensions/gameplay/rally/notebook/pacenote.lua
local function formatDistanceStringMeters(dist)
  return tostring(round(dist))..'m'
end
  --   "playbackAllowed name='"..self.name..
  --   "' condition='"..tostring(condition)..
  --   "' currLap="..tostring(currLap..
  --   "' condition='"..tostring(condition)..
  --   "' currLap="..tostring(currLap..
  --   " maxLap="..tostring(maxLap)))
  --   "' currLap="..tostring(currLap..
  --   " maxLap="..tostring(maxLap)))
@/lua/ge/extensions/gameplay/rally/loop/stagedCountdownUtils.lua
  if nodeData.inZone ~= nil then
    im.Text("In Zone: " .. tostring(nodeData.inZone))
    im.Text("Staged: " .. tostring(nodeData.staged))
    im.Text("In Zone: " .. tostring(nodeData.inZone))
    im.Text("Staged: " .. tostring(nodeData.staged))
  end
@/lua/ge/extensions/flowgraph/manager.lua
function C:createGraph(name, hidden, forceId)
  --print("Creating Graph. "..tostring(name).. "-" ..tostring(hidden))
  local graph = require('/lua/ge/extensions/flowgraph/graph')(self, name, forceId)
function C:createGraph(name, hidden, forceId)
  --print("Creating Graph. "..tostring(name).. "-" ..tostring(hidden))
  local graph = require('/lua/ge/extensions/flowgraph/graph')(self, name, forceId)
                  and (startPin:getTableType() ~= endPin:getTableType() and startPin:getTableType() ~= 'generic' and endPin:getTableType() ~= 'generic') then
            fg_utils.showLabel("x Incompatible Table Types: " .. tostring(startPin:getTableType()) .. ' and ' .. tostring(endPin:getTableType()), im.ImVec4(0.176, 0.125, 0.125, 0.706))
          else
                  and (startPin:getTableType() ~= endPin:getTableType() and startPin:getTableType() ~= 'generic' and endPin:getTableType() ~= 'generic') then
            fg_utils.showLabel("x Incompatible Table Types: " .. tostring(startPin:getTableType()) .. ' and ' .. tostring(endPin:getTableType()), im.ImVec4(0.176, 0.125, 0.125, 0.706))
          else
          else
            fg_utils.showLabel("x Incompatible Types: " .. tostring(startPin.type) .. ' and ' .. tostring(endPin.type), im.ImVec4(0.176, 0.125, 0.125, 0.706))
          end
          else
            fg_utils.showLabel("x Incompatible Types: " .. tostring(startPin.type) .. ' and ' .. tostring(endPin.type), im.ImVec4(0.176, 0.125, 0.125, 0.706))
          end
      local node
      node = self.graph:createNode(nodeData.type, tostring(id) + self:getGraphNodeOffset())
      node:__onDeserialized(nodeData)
      else
        log('E', logTag, 'targetNode node not found: ' .. tostring(linkData[3]))
      end
    else
      log('E', logTag, 'Source node not found: ' .. tostring(linkData[1]))
    end
    if not status then
      log('E', logTag, 'error while loading node ' .. tostring(requireFilename) .. ' : ' .. tostring(node) .. '. ' .. debug.tracesimple())
    else
    if not status then
      log('E', logTag, 'error while loading node ' .. tostring(requireFilename) .. ' : ' .. tostring(node) .. '. ' .. debug.tracesimple())
    else
    if child.macroID then
      table.insert(list, tostring(child.macroID))
    elseif child.nodes then
        if not status then
          self:logEvent("Error with hook  " .. dumps(h), "E", 'Error while executing Hook ' .. dumps(h) .. ": " .. tostring(err))
        end
@/lua/common/utils/languageMap.lua

  --res = res .. ' [' .. tostring(key) .. ']'
  return res
@/lua/vehicle/extensions/core/quickAccess.lua
  if item == nil then
    log("E", "core_quickAccess.selectItem", "item not found: " .. tostring(id))
    return itemSelectCallback({"error", "item_not_found"})
@/lua/ge/extensions/editor/api/core.lua
      elseif type.type == varTypes.LuaVar then
        local f = loadstring(type.name .. " = " .. tostring(on))
        f()
@/lua/ge/extensions/flowgraph/nodes/util/customLua.lua
    if not status then
      log('E', 'Custom Lua Node: " .. code', tostring(err))
      self:__setNodeError('work', 'Error while executing custom lua: '..code..' ' .. tostring(err))
      log('E', 'Custom Lua Node: " .. code', tostring(err))
      self:__setNodeError('work', 'Error while executing custom lua: '..code..' ' .. tostring(err))
      self.mgr:logEvent("Node Error in " .. dumps(self.name),"E", 'Error while executing custom lua: '..code..' ' .. tostring(err), {type = "node", node = self})
      self:__setNodeError('work', 'Error while executing custom lua: '..code..' ' .. tostring(err))
      self.mgr:logEvent("Node Error in " .. dumps(self.name),"E", 'Error while executing custom lua: '..code..' ' .. tostring(err), {type = "node", node = self})
    end
@/lua/ge/extensions/editor/tech/roadArchitect/export.lua
        -- Road header data.
        f:write('\n')
        -- Road header data.
        f:write('\n')
        if pType == 'road' then
          f:write('\n')
        elseif pType == 'junction' then
        elseif pType == 'junction' then
          f:write('\n')
        end
        if sType == 'road' then
          f:write('\n')
        elseif sType == 'junction' then
        elseif sType == 'junction' then
          f:write('\n')
        end
          local gP, rL = g.start, g.refLine
          local s, pX, pY, length = tostring(g.s), tostring(gP.x), tostring(gP.y), tostring(g.length)
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local gP, rL = g.start, g.refLine
          local s, pX, pY, length = tostring(g.s), tostring(gP.x), tostring(gP.y), tostring(g.length)
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local gP, rL = g.start, g.refLine
          local s, pX, pY, length = tostring(g.s), tostring(gP.x), tostring(gP.y), tostring(g.length)
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local gP, rL = g.start, g.refLine
          local s, pX, pY, length = tostring(g.s), tostring(gP.x), tostring(gP.y), tostring(g.length)
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local s, pX, pY, length = tostring(g.s), tostring(gP.x), tostring(gP.y), tostring(g.length)
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local Av, Bv, Cv, Dv = tostring(rL.vA), tostring(rL.vB), tostring(rL.vC), tostring(rL.vD)
          local s, pX, pY, length = tostring(g.s), tostring(gP.x), tostring(gP.y), tostring(g.length)
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local Av, Bv, Cv, Dv = tostring(rL.vA), tostring(rL.vB), tostring(rL.vC), tostring(rL.vD)
          local s, pX, pY, length = tostring(g.s), tostring(gP.x), tostring(gP.y), tostring(g.length)
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local Av, Bv, Cv, Dv = tostring(rL.vA), tostring(rL.vB), tostring(rL.vC), tostring(rL.vD)
          local s, pX, pY, length = tostring(g.s), tostring(gP.x), tostring(gP.y), tostring(g.length)
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local Av, Bv, Cv, Dv = tostring(rL.vA), tostring(rL.vB), tostring(rL.vC), tostring(rL.vD)
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local Av, Bv, Cv, Dv = tostring(rL.vA), tostring(rL.vB), tostring(rL.vC), tostring(rL.vD)
          f:write('\n')
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local Av, Bv, Cv, Dv = tostring(rL.vA), tostring(rL.vB), tostring(rL.vC), tostring(rL.vD)
          f:write('\n')
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local Av, Bv, Cv, Dv = tostring(rL.vA), tostring(rL.vB), tostring(rL.vC), tostring(rL.vD)
          f:write('\n')
          local Au, Bu, Cu, Du = tostring(rL.uA), tostring(rL.uB), tostring(rL.uC), tostring(rL.uD)
          local Av, Bv, Cv, Dv = tostring(rL.vA), tostring(rL.vB), tostring(rL.vC), tostring(rL.vD)
          f:write('\n')
          local g = geom[j]
          local s, el = tostring(g.s), g.elev
          local Ae, Be, Ce, De = tostring(el.a), tostring(el.b), tostring(el.c), tostring(el.d)
          local s, el = tostring(g.s), g.elev
          local Ae, Be, Ce, De = tostring(el.a), tostring(el.b), tostring(el.c), tostring(el.d)
          f:write('\n')
          local s, el = tostring(g.s), g.elev
          local Ae, Be, Ce, De = tostring(el.a), tostring(el.b), tostring(el.c), tostring(el.d)
          f:write('\n')
          local s, el = tostring(g.s), g.elev
          local Ae, Be, Ce, De = tostring(el.a), tostring(el.b), tostring(el.c), tostring(el.d)
          f:write('\n')
          local s, el = tostring(g.s), g.elev
          local Ae, Be, Ce, De = tostring(el.a), tostring(el.b), tostring(el.c), tostring(el.d)
          f:write('\n')
          local g = geom[j]
          local s, sE = tostring(g.s), g.superElev
          local Ae, Be, Ce, De = tostring(sE.a), tostring(sE.b), tostring(sE.c), tostring(sE.d)
          local s, sE = tostring(g.s), g.superElev
          local Ae, Be, Ce, De = tostring(sE.a), tostring(sE.b), tostring(sE.c), tostring(sE.d)
          f:write('\n')
          local s, sE = tostring(g.s), g.superElev
          local Ae, Be, Ce, De = tostring(sE.a), tostring(sE.b), tostring(sE.c), tostring(sE.d)
          f:write('\n')
          local s, sE = tostring(g.s), g.superElev
          local Ae, Be, Ce, De = tostring(sE.a), tostring(sE.b), tostring(sE.c), tostring(sE.d)
          f:write('\n')
          local s, sE = tostring(g.s), g.superElev
          local Ae, Be, Ce, De = tostring(sE.a), tostring(sE.b), tostring(sE.c), tostring(sE.d)
          f:write('\n')
          local g = geom[j]
          local widths, heights, s = g.widths, g.laneOffsets, tostring(g.s)
          f:write('\n')
              local wCubic, type, hData = lW.cubic, lW.type, heights[k]
              local id, typeStr, inner, outer = tostring(k), getTypeString(type), hData.inner, hData.outer
              local Aw, Bw, Cw, Dw = tostring(wCubic.a), tostring(wCubic.b), tostring(wCubic.c), tostring(wCubic.d)
              local id, typeStr, inner, outer = tostring(k), getTypeString(type), hData.inner, hData.outer
              local Aw, Bw, Cw, Dw = tostring(wCubic.a), tostring(wCubic.b), tostring(wCubic.c), tostring(wCubic.d)
              f:write('\n')
              local id, typeStr, inner, outer = tostring(k), getTypeString(type), hData.inner, hData.outer
              local Aw, Bw, Cw, Dw = tostring(wCubic.a), tostring(wCubic.b), tostring(wCubic.c), tostring(wCubic.d)
              f:write('\n')
              local id, typeStr, inner, outer = tostring(k), getTypeString(type), hData.inner, hData.outer
              local Aw, Bw, Cw, Dw = tostring(wCubic.a), tostring(wCubic.b), tostring(wCubic.c), tostring(wCubic.d)
              f:write('\n')
              local id, typeStr, inner, outer = tostring(k), getTypeString(type), hData.inner, hData.outer
              local Aw, Bw, Cw, Dw = tostring(wCubic.a), tostring(wCubic.b), tostring(wCubic.c), tostring(wCubic.d)
              f:write('\n')
              local wCubic, type, hData = lW.cubic, lW.type, heights[k]
              local id, typeStr, inner, outer = tostring(k), getTypeString(type), hData.inner, hData.outer
              local Aw, Bw, Cw, Dw = tostring(wCubic.a), tostring(wCubic.b), tostring(wCubic.c), tostring(wCubic.d)
              local id, typeStr, inner, outer = tostring(k), getTypeString(type), hData.inner, hData.outer
              local Aw, Bw, Cw, Dw = tostring(wCubic.a), tostring(wCubic.b), tostring(wCubic.c), tostring(wCubic.d)
              f:write('\n')
              local id, typeStr, inner, outer = tostring(k), getTypeString(type), hData.inner, hData.outer
              local Aw, Bw, Cw, Dw = tostring(wCubic.a), tostring(wCubic.b), tostring(wCubic.c), tostring(wCubic.d)
              f:write('\n')
              local id, typeStr, inner, outer = tostring(k), getTypeString(type), hData.inner, hData.outer
              local Aw, Bw, Cw, Dw = tostring(wCubic.a), tostring(wCubic.b), tostring(wCubic.c), tostring(wCubic.d)
              f:write('\n')
              local id, typeStr, inner, outer = tostring(k), getTypeString(type), hData.inner, hData.outer
              local Aw, Bw, Cw, Dw = tostring(wCubic.a), tostring(wCubic.b), tostring(wCubic.c), tostring(wCubic.d)
              f:write('\n')
@/lua/ge/extensions/util/screenshotCreator.lua

        im.TextUnformatted('Final resolution: ' .. tostring(x) .. ' x ' .. tostring(y))
        im.TextUnformatted('Megapixel = ' .. string.format('%0.2f', x * y / 1000000))

        im.TextUnformatted('Final resolution: ' .. tostring(x) .. ' x ' .. tostring(y))
        im.TextUnformatted('Megapixel = ' .. string.format('%0.2f', x * y / 1000000))
@/lua/ge/extensions/editor/undoHistory.lua
      local action = editor.history.undoStack[k]
      imgui.PushID1(tostring(k))
      if imgui.Selectable1(tostring(k) .. ": " .. action.name, isSel) then selectedIndex = k end
      imgui.PushID1(tostring(k))
      if imgui.Selectable1(tostring(k) .. ": " .. action.name, isSel) then selectedIndex = k end
      if imgui.IsItemHovered() then
      local action = editor.history.redoStack[k]
      imgui.PushID1(tostring(k) .. "redo")
      if imgui.Selectable1(tostring(k) .. ": " .. action.name, isSel) then selectedIndex2 = k end
      imgui.PushID1(tostring(k) .. "redo")
      if imgui.Selectable1(tostring(k) .. ": " .. action.name, isSel) then selectedIndex2 = k end
      if imgui.IsItemHovered() then
@/lua/ge/extensions/editor/toolUtilities/meshAuditionMgr.lua
          local flag = i == selectedMeshIdx
          if im.Selectable1(name .. "###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            selectedMeshIdx = i
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veStaticRenderView.lua
local function createRenderViewUIData(wndID, wndData)
  local wndName = wndNamePrefix .. tostring(wndID)
    else
      log('E','',"Invalid viewMode: " .. tostring(viewMode))
      return
  im.PushStyleVar2(im.StyleVar_WindowPadding, im.ImVec2(6, 6))
  if im.BeginPopup('viewcontrol' .. tostring(wndData.wndName)) then
    if im.BeginMenu('Mode') then
  if im.IsItemClicked(1) then
    im.OpenPopup('viewcontrol' .. tostring(wndData.wndName))
  end
@/lua/ge/extensions/util/inputSystemUtils.lua

  print(tostring(bindingCount) .. ' total bindings')
  local tblLen = math.min(#sortedActions, 20)
  print('top ' .. tostring(tblLen) .. ' actions:')
  for n = 1, tblLen do
  for n = 1, tblLen do
    print(' * ' .. sortedActions[n][1] .. ' - ' .. tostring(sortedActions[n][2]))
  end
local function padnum(d) return ("%012d"):format(d) end
local function naturalSortHelper(a, b) return tostring(a):gsub("%d+",padnum) < tostring(b):gsub("%d+", padnum) end
local function padnum(d) return ("%012d"):format(d) end
local function naturalSortHelper(a, b) return tostring(a):gsub("%d+",padnum) < tostring(b):gsub("%d+", padnum) end
      if not content then
        log('E', 'input', 'unable to open file: ' .. tostring(filepath))
        goto continue
      if not info then
        log('E', 'input', 'unable to read file: ' .. tostring(filepath))
        goto continue
      if not isValidVIdPId(info.vidpid) then
        --print('invalid vid/pid: ' .. tostring(info.vidpid))
        info.vidpid = nil
        table.sort(info.bindings, function(a, b)
          if not a.control or not b.control then return tostring(a) < tostring(b) end -- fallback to table pointer in worst case the data is broken
          if a.control == b.control and a.action and b.action then
        table.sort(info.bindings, function(a, b)
          if not a.control or not b.control then return tostring(a) < tostring(b) end -- fallback to table pointer in worst case the data is broken
          if a.control == b.control and a.action and b.action then
        writeFile(filepath, jsonFinal)
        print('Resaved ' .. tostring(filepath))
      else
      else
        print(tostring(filepath) .. ' - no changes needed')
      end
@/lua/ge/extensions/flowgraph/basenode.lua
    __index = function(self, key) return emptyPin end,
    __newindex = function(self, key, value) log('E', self.mgr.logTag, 'cannot write to input pin: ' .. tostring(key)) print(debug.tracesimple()) end,
  })
  if not status then
    log('E', 'node.work', tostring(err))
    self:__setNodeError('work', 'Error while executing node:work(): ' .. tostring(err))
    log('E', 'node.work', tostring(err))
    self:__setNodeError('work', 'Error while executing node:work(): ' .. tostring(err))
    self.mgr:logEvent("Node Error in " .. dumps(self.name), "E", 'Error while executing node:work(): ' .. tostring(err), { type = "node", node = self })
    self:__setNodeError('work', 'Error while executing node:work(): ' .. tostring(err))
    self.mgr:logEvent("Node Error in " .. dumps(self.name), "E", 'Error while executing node:work(): ' .. tostring(err), { type = "node", node = self })
  end
  if not status then
    log('E', 'node.onNodeReset', tostring(err))
    self:__setNodeError('onNodeReset', 'Error while executing node:onNodeReset(): ' .. tostring(err))
    log('E', 'node.onNodeReset', tostring(err))
    self:__setNodeError('onNodeReset', 'Error while executing node:onNodeReset(): ' .. tostring(err))
    self.mgr:logEvent("Node Error in " .. dumps(self.name), "E", 'Error while executing node:onNodeReset(): ' .. tostring(err), { type = "node", node = self })
    self:__setNodeError('onNodeReset', 'Error while executing node:onNodeReset(): ' .. tostring(err))
    self.mgr:logEvent("Node Error in " .. dumps(self.name), "E", 'Error while executing node:onNodeReset(): ' .. tostring(err), { type = "node", node = self })
  end
      if not status then
        log('E', 'node.workOnce', tostring(err))
        self:__setNodeError('work', 'Error while executing node:workOnce(): ' .. tostring(err))
        log('E', 'node.workOnce', tostring(err))
        self:__setNodeError('work', 'Error while executing node:workOnce(): ' .. tostring(err))
        self.mgr:logEvent("Node Error in " .. dumps(self.name), "E", 'Error while executing node:workOnce(): ' .. tostring(err), { type = "node", node = self })
        self:__setNodeError('work', 'Error while executing node:workOnce(): ' .. tostring(err))
        self.mgr:logEvent("Node Error in " .. dumps(self.name), "E", 'Error while executing node:workOnce(): ' .. tostring(err), { type = "node", node = self })
      end
      if not status then
        log('E', 'node.work', tostring(err))
        self:__setNodeError('work', 'Error while executing node:work(): ' .. tostring(err))
        log('E', 'node.work', tostring(err))
        self:__setNodeError('work', 'Error while executing node:work(): ' .. tostring(err))
        self.mgr:logEvent("Node Error in " .. dumps(self.name), "E", 'Error while executing node:work(): ' .. tostring(err), { type = "node", node = self })
        self:__setNodeError('work', 'Error while executing node:work(): ' .. tostring(err))
        self.mgr:logEvent("Node Error in " .. dumps(self.name), "E", 'Error while executing node:work(): ' .. tostring(err), { type = "node", node = self })
      end
      if not successful then
        log('E', self.mgr.logTag, 'Duplicate pin names not allowed: ' .. tostring(name))
        return
    else
      log('E', self.mgr.logTag, 'Duplicate pin names not allowed: ' .. tostring(name))
      return
    if self.pinInLocal[newName].id ~= pin.id then
      log('W', 'baseNode', 'Pin rename failed - renaming pin '..tostring(pin.name) ..' to '..tostring(newName)..'. Pin Name: '..tostring(newName).. ' is already used!')
    end
    if self.pinInLocal[newName].id ~= pin.id then
      log('W', 'baseNode', 'Pin rename failed - renaming pin '..tostring(pin.name) ..' to '..tostring(newName)..'. Pin Name: '..tostring(newName).. ' is already used!')
    end
    if self.pinInLocal[newName].id ~= pin.id then
      log('W', 'baseNode', 'Pin rename failed - renaming pin '..tostring(pin.name) ..' to '..tostring(newName)..'. Pin Name: '..tostring(newName).. ' is already used!')
    end
    if self.obsolete then
      im.TextUnformatted("OBSOLETE: " .. tostring(self.obsolete))
    end
    if self.description and self.description ~= "" then
      im.TextUnformatted(tostring(self.description))
    elseif self.nodeType == "macro/integrated" and self.targetGraph.description then
    if self.todo then
      im.TextUnformatted("TODO: " .. tostring(self.todo))
    end

    --im.TextUnformatted('PIN ID: ' .. tostring(self.id))
    im.PopTextWrapPos()
    builder:Middle()
    im.TextUnformatted(tostring(self._flowLevel))
  elseif drawType == 'simple' then
  if not status then
    log('E', logTag ..'_drawMiddle', tostring(err))
    self:__setNodeError('work', 'Error while executing node:_drawMiddle(): ' .. tostring(err))
    log('E', logTag ..'_drawMiddle', tostring(err))
    self:__setNodeError('work', 'Error while executing node:_drawMiddle(): ' .. tostring(err))
  end
  --for parentNode, _ in pairs(self._flowColors) do
  --  im.TextUnformatted(tostring(parentNode.id))
  --end
  if editor.getPreference("flowgraph.debug.displayIds") then
    im.Text("id: %s", tostring(self.id))
  end
      else
        log('W', self.mgr.logTag, 'Unable to set const value, pin not found: ' .. tostring(pinName) .. 'neither updated name: ' .. tostring(updatedName))
      end
      else
        log('W', self.mgr.logTag, 'Unable to set const value, pin not found: ' .. tostring(pinName) .. 'neither updated name: ' .. tostring(updatedName))
      end
      else
        log('W', self.mgr.logTag, 'Unable to set quickAccess value, in pin not found: ' .. tostring(pinName))
      end
      else
        log('W', self.mgr.logTag, 'Unable to set quickAccess value, out pin not found: ' .. tostring(pinName))
      end
        else
          log('W', self.mgr.logTag, 'Unable to hide pin, in pin not found: ' .. tostring(pinName))
        end
        else
          log('W', self.mgr.logTag, 'Unable to hide pin, out pin not found: ' .. tostring(pinName))
        end
  if err then
    log('E', self.name, tostring(err))
  end
  for k, v in pairs(derivedClass) do
    --print('k = ' .. tostring(k) .. ' = '.. tostring(v) )
    o[k] = v
  for k, v in pairs(derivedClass) do
    --print('k = ' .. tostring(k) .. ' = '.. tostring(v) )
    o[k] = v
@/lua/ge/extensions/editor/tech/roadArchitect/staticMesh.lua
      static:setField('decalType', 0, 'None')
      local meshId = displayName .. ' ' .. tostring(roadIdx) .. '-' .. tostring(lIdx) .. '-' .. tostring(j)
      static:registerObject(meshId)
      static:setField('decalType', 0, 'None')
      local meshId = displayName .. ' ' .. tostring(roadIdx) .. '-' .. tostring(lIdx) .. '-' .. tostring(j)
      static:registerObject(meshId)
      static:setField('decalType', 0, 'None')
      local meshId = displayName .. ' ' .. tostring(roadIdx) .. '-' .. tostring(lIdx) .. '-' .. tostring(j)
      static:registerObject(meshId)
  static:setField('decalType', 0, 'None')
  local meshId = layer.matDisplay .. ' ' .. tostring(roadIdx) .. '- single -' .. tostring(sIdx)
  static:registerObject(meshId)
  static:setField('decalType', 0, 'None')
  local meshId = layer.matDisplay .. ' ' .. tostring(roadIdx) .. '- single -' .. tostring(sIdx)
  static:registerObject(meshId)
@/lua/ge/extensions/editor/rallyEditor.lua
      end
      im.tooltip(tostring(currentPath.fname))
      -- im.SameLine()
      -- im.SameLine()
      -- im.Text(""..tostring(currentPath.fname))

      -- im.Text("Mission: "..tostring(currentPath:getMissionId()))
      -- im.SameLine()
  isDev = devTxtExists()
  -- print('isDev='..tostring(isDev))
@/lua/vehicle/extensions/mqttGrafanaDemo.lua
local function handleMQTTMessage(mid, topic, payload)
  log("I", '', "Received MQTT message: " .. tostring(topic) .. " - " .. tostring(payload))
  if topic == "button/press" then
local function handleMQTTMessage(mid, topic, payload)
  log("I", '', "Received MQTT message: " .. tostring(topic) .. " - " .. tostring(payload))
  if topic == "button/press" then
@/lua/ge/extensions/editor/tech/roadArchitect/profiles.lua
        {
          name = im.ArrayChar(32, 'Edge L ' .. tostring(i)),
          doNotDelete = im.BoolPtr(true),
        {
          name = im.ArrayChar(32, 'Edge R ' .. tostring(i)),
          doNotDelete = im.BoolPtr(true),
          {
            name = im.ArrayChar(32, 'Lane div ' .. tostring(i) .. '-' .. tostring(j)),
            doNotDelete = im.BoolPtr(true),
          {
            name = im.ArrayChar(32, 'Lane div ' .. tostring(i) .. '-' .. tostring(j)),
            doNotDelete = im.BoolPtr(true),
          {
            name = im.ArrayChar(32, 'Stop line A' .. tostring(i)),
            doNotDelete = im.BoolPtr(true),
          {
            name = im.ArrayChar(32, 'Stop line B' .. tostring(i)),
            doNotDelete = im.BoolPtr(true),
        {
          name = im.ArrayChar(32, 'Edge Blend L ' .. tostring(i)),
          doNotDelete = im.BoolPtr(true),
        {
          name = im.ArrayChar(32, 'Edge Blend R ' .. tostring(i)),
          doNotDelete = im.BoolPtr(true),
        {
          name = im.ArrayChar(32, 'Light tread ' .. tostring(i)),
          isHidden = true,
        {
          name = im.ArrayChar(32, 'Heavy tread ' .. tostring(i)),
          isHidden = true,
        {
          name = im.ArrayChar(32, 'Dirt track ' .. tostring(i)),
          isHidden = true,
        {
          name = im.ArrayChar(32, 'Damage overlay ' .. tostring(i)),
          isHidden = true,
        {
          name = im.ArrayChar(32, 'Crack overlay ' .. tostring(i)),
          isHidden = true,
        fadeS = im.FloatPtr(layer.fadeS[0]), fadeE = im.FloatPtr(layer.fadeE[0]),
        mat = tostring(layer.mat),
        rot = im.IntPtr(layer.rot[0]),
      fadeS = im.FloatPtr(layer.fadeS[0]), fadeE = im.FloatPtr(layer.fadeE[0]),
      mat = tostring(layer.mat),
      rot = im.IntPtr(layer.rot[0]),
    if l then
      pSer[tostring(i)] = {
        type = l.type,
        fadeS = lay.fadeS[0], fadeE = lay.fadeE[0],
        mat = tostring(lay.mat),
        rot = lay.rot[0],
  for i = -20, 20 do
    local l = pSer[tostring(i)]
    if l then
@/lua/vehicle/controller.lua
      if controller.updateFixedStep ~= nil then
        print("  sortedControllers[" .. i .. "].updateFixedStep(dt) -- " .. tostring(controller.typeName))
      end
      if controller.updateGFX ~= nil then
        print("  sortedControllers[" .. i .. "].updateGFX(dt) -- " .. tostring(controller.typeName))
      end
      if controller.updateWheelsIntermediate ~= nil then
        print("  sortedControllers[" .. i .. "].updateWheelsIntermediate(dt) -- " .. tostring(controller.typeName))
      end
      if controller.beamBroke ~= nil then
        print("  sortedControllers[" .. i .. "].beamBroke(id, energy) -- " .. tostring(controller.typeName))
      end
      if controller.beamDeformed ~= nil then
        print("  sortedControllers[" .. i .. "].beamDeformed(id, ratio) -- " .. tostring(controller.typeName))
      end
      if controller.nodeCollision ~= nil then
        print("  sortedControllers[" .. i .. "].nodeCollision(p) -- " .. tostring(controller.typeName))
      end
      if controller.onCouplerFound ~= nil then
        print("  sortedControllers[" .. i .. "].onCouplerFound(nodeId, obj2id, obj2nodeId) -- " .. tostring(controller.typeName))
      end
      if controller.onCouplerAttached ~= nil then
        print("  sortedControllers[" .. i .. "].onCouplerAttached(nodeId, obj2id, obj2nodeId, attachSpeed, attachEnergy) -- " .. tostring(controller.typeName))
      end
      if controller.onCouplerDetached ~= nil then
        print("  sortedControllers[" .. i .. "].onCouplerDetached(nodeId, obj2id, obj2nodeId, breakForce) -- " .. tostring(controller.typeName))
      end
      if controller.onGameplayEvent ~= nil then
        print("  sortedControllers[" .. i .. "].onGameplayEvent(eventName, ...) -- " .. tostring(controller.typeName))
      end
      if controller.debugDraw ~= nil then
        print("  sortedControllers[" .. i .. "].debugDraw(focusPos) -- " .. tostring(controller.typeName))
      end
      if controller.settingsChanged ~= nil then
        print("  sortedControllers[" .. i .. "].settingsChanged() -- " .. tostring(controller.typeName))
      end
@/lua/ge/extensions/editor/missionEditor.lua
    if missionData._issueList.importantCount < 10 and missionData._issueList.importantCount > 0 then
      icon = "filter_"..tostring(missionData._issueList.importantCount)
    end
@/lua/ge/extensions/gameplay/drag/debug.lua
        im.SameLine()
        im.Text(" | Is Used: " .. tostring(p.isUsed))
        if p.isUsed then
@/lua/ge/extensions/flowgraph/nodes/activity/autoStarGoals.lua
    if type(value) == 'string' or type(value) == 'number' then
      context[key] = tostring(value)
    end
@/lua/ge/extensions/flowgraph/nodes/vehicle/replay.lua
  im.Text(self.replayName)
  im.Text(tostring(self.startReplay))
  im.Text(tostring(self.stopReplay))
  im.Text(tostring(self.startReplay))
  im.Text(tostring(self.stopReplay))
  --im.BeginChild1("child",im.ImVec2(self.sliderWidth[0],50), true)
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/vePartTextView.lua
  writeFile(vEditor.astFilename, jsonAST.stringify(vEditor.ast.ast))
  log('I', '', 'Wrote file: '.. tostring(vEditor.astFilename))
end
  editNodeIdx = nodeIdx
  log('I', '', '_editNode: ' .. tostring(nodeIdx))
  nodeEditTextInput[0] = 0
  end
  im.PushID1(tostring(nodeIdx))
  im.TextUnformatted(text)
    im.TableNextColumn()
    im.TextUnformatted(tostring(lineNo))
    im.TableNextColumn()
      im.Checkbox("Scroll to selection", scrollToSelection)
      im.TextUnformatted(tostring(vEditor.selectedPart) .. ' - ')
      if jbeamFilename then
      if jbeamFilename then
        im.TextUnformatted(tostring(jbeamFilename))
      end
    local nodeType = node[1]
    im.TextUnformatted(tostring(nodeType) .. ' - ' .. tostring(editNodeIdx))
    im.TextUnformatted('Raw node data: ' .. dumps(node))
    local nodeType = node[1]
    im.TextUnformatted(tostring(nodeType) .. ' - ' .. tostring(editNodeIdx))
    im.TextUnformatted('Raw node data: ' .. dumps(node))
@/lua/ge/extensions/editor/api/genericInspector.lua
              for i = 1, val.elementCount do
                self.valueInspector:valueEditorGui(val.name, val.value[i] or "", i, val.name .. "["..tostring(i - 1).."]", val.fieldDocs, val.type, val.typeName, val, function (fieldName, fieldValue, arrayIndex, customData) self.fieldSetter(fieldName, fieldValue, arrayIndex, customData, true) end, contextMenuUI, val.indeterminateFlags)
              end
            imgui.PushID1(val.arrayName .. "_ARRAY_ITEMS_" .. i)
            if imgui.CollapsingHeader1("[" .. tostring(i - 1) .. "]", nodeFlags) then
              for _, arrayField in ipairs(val.sortedFields) do
  self.valueInspector:initializeTables()
  self.valueInspector.inspectorName = "genericInspector" .. tostring(genericInspectorCount)
  genericInspectorCount = genericInspectorCount + 1
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/vePartTree.lua

    --log('I', '', 'processing file: ' .. tostring(jbeamFilename))
    jbeamTableSchema.process(part, true, true)
  end
  log('W', '', 'Node not found in any part: ' .. tostring(nodeId))
  brokenNodes[nodeId] = true
  im.TableSetColumnIndex(0)
  local label = _nodeLabel or tostring(node)
  if type(node) == 'table' then
    if nodeDefaultOpen then flags = bit.bor(flags, im.TreeNodeFlags_DefaultOpen) end
    local open = im.TreeNodeEx1('##treeData' .. tostring(node), flags)
    im.SameLine()
    end
    local clicked = im.Selectable1(label .. '##treeSelData' .. tostring(node), node.__selected, 0)
    if node.__selected then
            im.PushStyleColor2(im.Col_Text, colorValue)
            _renderNode(v, false, tostring(k))
            im.PopStyleColor()
            im.PushStyleColor2(im.Col_Text, colorKey)
            im.TextUnformatted(tostring(k))
            im.PopStyleColor()
            im.PushStyleColor2(im.Col_Text, colorElement)
            im.TextUnformatted(tostring(v))
            im.PopStyleColor()
    im.TableSetColumnIndex(1)
    --im.TreeNodeEx1(label .. '##treeData' .. tostring(node), bit.bor(im.TreeNodeFlags_SpanFullWidth, im.TreeNodeFlags_Leaf, im.TreeNodeFlags_NoTreePushOnOpen, im.TreeNodeFlags_Bullet))
    im.PushStyleColor2(im.Col_Text, colorElement)
      if not str then
        log('E', '', 'Unable to read file: ' .. tostring(jbeamFilename))
        return
    if im.MenuItem1("Open location in file explorer") then
      Engine.Platform.exploreFolder(tostring(rightClickedPart[3]))
    end
@/lua/ge/extensions/scenario/quickRaceLoader.lua
  if #levelInfo.previews == 0 then
    log('W', 'scenarios', 'scenario has no previews: ' .. tostring(levelInfo.scenarioName))
  end
      if not file then
        log('E', 'failed to load this track ' , tostring(trackFile).. ' Check Json file')
      elseif procedurals ~= not file.procedural then -- no this cannot be changed to procedurals == file.procedural, becaus then false == nil -> false
@/lua/ge/extensions/util/export.lua
local function _addBuffer(gltfRoot, data, dataSize, name)
  -- log('D', logTag, 'Adding buffer ' ..dumps(name) .. " size=" .. tostring(dataSize))
  -- buffer table goes first
      buffer.uri = base64Prefix .. res
      -- log('D', logTag, 'Embedded base64-encoded buffer of length: ' .. tostring(out_len[0]))
    else
local function _addBufferviewAccessor(gltfRoot, bufferID, byteOffset, byteLength, accessor, name)
  -- log('D', logTag, 'Adding bufferViewAccessor ' ..dumps(name) .. " buf=" ..dumps(bufferID) .. " offset=" ..dumps(byteOffset).. " len=" .. tostring(byteLength))
  end
  -- log("I", logTag," *** " .. tostring(meshName) .. ' : ' .. tostring(submeshInfo.startIndex) .. '[' .. tostring(submeshInfo.indexCount) .. ']')
  -- first: add a new bufferview and accessor
  end
  -- log("I", logTag," *** " .. tostring(meshName) .. ' : ' .. tostring(submeshInfo.startIndex) .. '[' .. tostring(submeshInfo.indexCount) .. ']')
  -- first: add a new bufferview and accessor
  end
  -- log("I", logTag," *** " .. tostring(meshName) .. ' : ' .. tostring(submeshInfo.startIndex) .. '[' .. tostring(submeshInfo.indexCount) .. ']')
  -- first: add a new bufferview and accessor
      if n1 == nil then
        n1 = tostring(id1)
      end
      if n2 == nil then
        n2 = tostring(id2)
      end
      else
        log('E', logTag, 'texture file not found: ' .. tostring(filepathIn))
        return nil
      if not convertDDSToPNG(filepathIn, filepath) then
        log('E', logTag, 'Unable to convert dds to png: ' .. tostring(filepath))
      end
      end
      log('I', logTag, 'Converted dds to png: ' .. tostring(filepathIn) .. ' > ' .. tostring(filepath))
    end
      end
      log('I', logTag, 'Converted dds to png: ' .. tostring(filepathIn) .. ' > ' .. tostring(filepath))
    end
  else
    log('E', logTag, 'Unsupported texture format: ' .. tostring(filepath))
    return nil
  if not f then
    log('E', logTag, 'unable to open texture file: ' .. tostring(filepath))
    return nil
    table.insert(keyFrameTimes, frameTime)
    print(' ** frame ' .. tostring(framesRecorded) .. ' = ' .. tostring(frameTime) ..' s')
  else
    table.insert(keyFrameTimes, frameTime)
    print(' ** frame ' .. tostring(framesRecorded) .. ' = ' .. tostring(frameTime) ..' s')
  else
  local jsonHandler = function(gltfRoot)
    jsonWriteFile(tostring(filename), gltfRoot, true, 20)
    bufferPathPattern = nil
  local glbHandler = function(gltfRoot)
    local f = io.open(tostring(filename), "wb")
    local bit = require "bit"
@/lua/ge/extensions/core/sounds.lua

  audioBlurLog('I','AUDIO',string.format("ui changed: %s => %s  gameAudioBlurValue = %0.1f (old = %0.1f) (interactingWithMissionUI = %s)", tostring(fromState), tostring(toState), gameAudioBlurValue, old_value, tostring(interactingWithMissionUI)))
end

  audioBlurLog('I','AUDIO',string.format("ui changed: %s => %s  gameAudioBlurValue = %0.1f (old = %0.1f) (interactingWithMissionUI = %s)", tostring(fromState), tostring(toState), gameAudioBlurValue, old_value, tostring(interactingWithMissionUI)))
end

  audioBlurLog('I','AUDIO',string.format("ui changed: %s => %s  gameAudioBlurValue = %0.1f (old = %0.1f) (interactingWithMissionUI = %s)", tostring(fromState), tostring(toState), gameAudioBlurValue, old_value, tostring(interactingWithMissionUI)))
end
  end
  audioBlurLog('I','AUDIO',string.format("missionInfo changed: %s => %s  gameAudioBlurValue = %0.1f (interactingWithMissionUI = %s)", tostring(fromState), tostring(toState), gameAudioBlurValue, tostring(interactingWithMissionUI)))
end
  end
  audioBlurLog('I','AUDIO',string.format("missionInfo changed: %s => %s  gameAudioBlurValue = %0.1f (interactingWithMissionUI = %s)", tostring(fromState), tostring(toState), gameAudioBlurValue, tostring(interactingWithMissionUI)))
end
  end
  audioBlurLog('I','AUDIO',string.format("missionInfo changed: %s => %s  gameAudioBlurValue = %0.1f (interactingWithMissionUI = %s)", tostring(fromState), tostring(toState), gameAudioBlurValue, tostring(interactingWithMissionUI)))
end
@/lua/ge/extensions/gameplay/drag/saveSystem.lua
  if not vehicleDetails or not vehicleDetails.current then
    log('W', logTag, 'Could not get vehicle details for ID: ' .. tostring(vehicleId))
    return "vehicle_" .. tostring(vehicleId)
    log('W', logTag, 'Could not get vehicle details for ID: ' .. tostring(vehicleId))
    return "vehicle_" .. tostring(vehicleId)
  end
  if not configFile or configFile == "" then
    log('W', logTag, 'No config file path found for vehicle ID: ' .. tostring(vehicleId))
    return "vehicle_" .. tostring(vehicleId)
    log('W', logTag, 'No config file path found for vehicle ID: ' .. tostring(vehicleId))
    return "vehicle_" .. tostring(vehicleId)
  end
  log('W', logTag, 'Failed to hash config file: ' .. configFile .. ', using vehicle ID fallback')
  return "vehicle_" .. tostring(vehicleId)
end
  else
    log('E', 'drag_save_system', 'Failed to save facilities: ' .. tostring(error))
    return false
@/lua/ge/extensions/statistics/statistics.lua
  if not vehicleTable then
    log('E', logTag, 'Vehicle not found in stats table: vehicleID = '..tostring(vehicleID))
    return 0,0

  log('I', logTag, 'DEBUG_generateScoreForMedal called...'..tostring(medalString))

  log('I', logTag, 'percent: '..tostring(percent))
  log('I', logTag, 'totalMaxPoints: '..tostring(totalMaxPoints))
  log('I', logTag, 'percent: '..tostring(percent))
  log('I', logTag, 'totalMaxPoints: '..tostring(totalMaxPoints))
  playerPoints = percent * totalMaxPoints
  log('I', logTag, 'playerPoints: '..tostring(playerPoints))
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamSpellchecker.lua
    if ok == false then
      log('E', "jbeam.parseFile","unable to decode JSON: "..tostring(filename))
      log('E', "jbeam.parseFile","JSON decoding error: "..tostring(data))
      log('E', "jbeam.parseFile","unable to decode JSON: "..tostring(filename))
      log('E', "jbeam.parseFile","JSON decoding error: "..tostring(data))
      return nil
  else
    log('E', "jbeam.parseFile","unable to read file: "..tostring(filename))
  end
          else
            --log('D', "" *** "..tostring(rowKey).." = "..tostring(rowValue).." ["..type(rowValue).."]")
          else
            --log('D', "" *** "..tostring(rowKey).." = "..tostring(rowValue).." ["..type(rowValue).."]")
@/lua/ge/extensions/editor/assetDeduplicator.lua
          local icon = isSelected and iconCheck or iconClose
          if editor.uiIconImageButton(icon, im.ImVec2(24, 24), nil, nil, nil, "sel_" .. tostring(i) .. "_" .. tostring(name)) then
            toggled = true
          local icon = isSelected and iconCheck or iconClose
          if editor.uiIconImageButton(icon, im.ImVec2(24, 24), nil, nil, nil, "sel_" .. tostring(i) .. "_" .. tostring(name)) then
            toggled = true
          local current = linkChoice[origin] or stock[1]
          local comboId = "##link_combo_" .. tostring(i)
          if im.BeginCombo(comboId, current) then
          local current = linkChoice[origin] or mod[1]
          local comboId = "##link_combo_" .. tostring(i)
          if im.BeginCombo(comboId, current) then
@/lua/ge/extensions/core/jobsystem.lua
    if dt > res.maxdt then
      --print(" *** yield taken ***: " .. tostring(dt))
      coroutine.yield()
    else
      --print("*** yield skipped: " .. tostring(dt))
    end
    if not errorfree then
      log('E', 'jobsystem', "job error: " .. tostring(value) .. ' / ' .. debug.traceback(co.t))
    end
  for i = #toRemove, 1, -1 do
    --log('E', 'jobsystem', 'removing entry ' .. tostring(i) .. ' / fct: ' .. tostring(coroutines[i].fct))
    local ci = toRemove[i]
  for i = #toRemove, 1, -1 do
    --log('E', 'jobsystem', 'removing entry ' .. tostring(i) .. ' / fct: ' .. tostring(coroutines[i].fct))
    local ci = toRemove[i]
@/lua/ge/extensions/editor/resourceChecker/resourceUtil.lua
      if not tableIsEmpty(objects) then
        log('I', '', 'parsing all materials file: ' .. tostring(fn))
        for _, obj in ipairs(objects) do
    job.sleep(0.001)
    log('I', '', 'Found ' ..tostring(count0).. ' old materials' )
    log('I', '', 'Found ' ..tostring(countPBR).. ' PBR materials' )
    log('I', '', 'Found ' ..tostring(count0).. ' old materials' )
    log('I', '', 'Found ' ..tostring(countPBR).. ' PBR materials' )
    isDone = 1
          if mat and mat.name then
            log('I', '', ' * ' .. tostring(mat.name) .. ' - mapTo: ' .. tostring(mat.mapTo) )
            local matID = tostring(mat.name) .. '|' .. tostring(file) .. '|' .. tostring(k)
          if mat and mat.name then
            log('I', '', ' * ' .. tostring(mat.name) .. ' - mapTo: ' .. tostring(mat.mapTo) )
            local matID = tostring(mat.name) .. '|' .. tostring(file) .. '|' .. tostring(k)
            log('I', '', ' * ' .. tostring(mat.name) .. ' - mapTo: ' .. tostring(mat.mapTo) )
            local matID = tostring(mat.name) .. '|' .. tostring(file) .. '|' .. tostring(k)
            duplicatelist[matID] = {mat.name, mat.mapTo, file}
            log('I', '', ' * ' .. tostring(mat.name) .. ' - mapTo: ' .. tostring(mat.mapTo) )
            local matID = tostring(mat.name) .. '|' .. tostring(file) .. '|' .. tostring(k)
            duplicatelist[matID] = {mat.name, mat.mapTo, file}
            log('I', '', ' * ' .. tostring(mat.name) .. ' - mapTo: ' .. tostring(mat.mapTo) )
            local matID = tostring(mat.name) .. '|' .. tostring(file) .. '|' .. tostring(k)
            duplicatelist[matID] = {mat.name, mat.mapTo, file}
    table.sort(duplicated, function(a,b) return string.upper(a) < string.upper(b) end)
    log('I', '', 'Found ' ..tostring(countduplicate).. ' duplicates' )
    job.sleep(0.001)
      if not tableIsEmpty(objects) then
        log('I', '', 'parsing all materials file: ' .. tostring(fn))
        job.yield()
      if not tableIsEmpty(objects) then
        log('I', '', 'parsing all materials file: ' .. tostring(fn))
        for _, obj in ipairs(objects) do
        job.yield()
        log('I', '', 'parsing all materials file: ' .. tostring(fn))
        for _, obj in ipairs(objects) do
      job.yield()
      table.insert(shapes, {k.."  used: "..tostring(v[2]).." times. Textures memory usage: "..string.format("%.2f", v[1]/1048576).." MB", v[1]})
      countduplicate = countduplicate + 1
        if not convertDDSToPNG(filepathIn, filepath) then
          log('E', 'Unable to convert dds to png: ' .. tostring(filepathIn))
        end
        end
        log('I', 'Converted dds to png: ' .. tostring(filepath))
        table.insert(resultTable, filepath)
      else
        log('I', 'PNG file already exists: ' .. tostring(v:gsub('.dds', '.png')))
      end
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/simpleFollowDecalroad.lua
  self.receivedInfo = false
  be:queueAllObjectLua('obj:queueGameEngineLua("extensions.hook(\\"onVehicleSubmitInfo\\","..tostring(objectId)..","..serialize(ai.scriptState())..")")')
end
    im.Text("No Road found:")
    im.Text(tostring( self.pinIn.roadName.value))
  else
@/lua/ge/extensions/career/modules/computer.lua
  for inventoryId, computerFunction in pairs(computerFunctions.vehicleSpecific) do
    computerFunctionsForUI.vehicleSpecific[tostring(inventoryId)] = computerFunction
  end
    vehicleData.thumbnail = career_modules_inventory.getVehicleThumbnail(vehicleData.inventoryId) .. "?" .. (vehicleData.dirtyDate or "")
    vehicleData.inventoryId = tostring(vehicleData.inventoryId)
  end
@/lua/ge/extensions/editor/tech/roadArchitect/render.lua
        if theta1 <= theta2 then
          dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(dist)) .. ' m ', textA, true, false, textB)
          dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(deg(theta1))) .. ' ° ', textA, true, false, textB)
          dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(dist)) .. ' m ', textA, true, false, textB)
          dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(deg(theta1))) .. ' ° ', textA, true, false, textB)
          local vec5 = v1 * 5.0
        else
          dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(dist)) .. ' m ', textA, true, false, textB)
          dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(deg(theta2))) .. ' ° ', textA, true, false, textB)
          dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(dist)) .. ' m ', textA, true, false, textB)
          dbgDraw.drawTextAdvanced(pInt2D, tostring(util.round2(deg(theta2))) .. ' ° ', textA, true, false, textB)
          local vec5 = v1 * 5.0
    if pos:squaredDistance(camPos) < innerCullLimSq then
      dbgDraw.drawTextAdvanced(pos, tostring(j), textA, true, false, textB)
    end
        if pos:squaredDistance(camPos) < innerCullLimSq then
          dbgDraw.drawTextAdvanced(pos, tostring(lane), textA, true, false, textB)
        end
    util.drawGroupSphere(p)
    dbgDraw.drawTextAdvanced(p, tostring(i), textA, true, false, textB)
  end
@/lua/ge/extensions/flowgraph/nodes/gameplay/crawl/setupCrawl.lua

  log('D', 'SetupCrawl', string.format('Input values - trailId: "%s", vehicleId: %s', tostring(trailId), tostring(vehicleId)))

  log('D', 'SetupCrawl', string.format('Input values - trailId: "%s", vehicleId: %s', tostring(trailId), tostring(vehicleId)))

  log('D', 'SetupCrawl', 'Loading trail: ' .. tostring(trailId))
  local trail = self.bridge.loadCrawlTrail(trailId)
  if not trail then
    log('E', 'SetupCrawl', 'Failed to load trail: ' .. tostring(trailId))
    self.pinOut.success.value = false
  log('D', 'SetupCrawl', string.format('Trail loaded successfully - name: "%s", pathId: "%s", boundaryId: "%s", startingPositionId: "%s"',
    tostring(trail.name), tostring(trail.pathId), tostring(trail.boundaryId), tostring(trail.startingPositionId)))
  log('D', 'SetupCrawl', string.format('Trail loaded successfully - name: "%s", pathId: "%s", boundaryId: "%s", startingPositionId: "%s"',
    tostring(trail.name), tostring(trail.pathId), tostring(trail.boundaryId), tostring(trail.startingPositionId)))
  log('D', 'SetupCrawl', string.format('Trail loaded successfully - name: "%s", pathId: "%s", boundaryId: "%s", startingPositionId: "%s"',
    tostring(trail.name), tostring(trail.pathId), tostring(trail.boundaryId), tostring(trail.startingPositionId)))
  log('D', 'SetupCrawl', string.format('Trail loaded successfully - name: "%s", pathId: "%s", boundaryId: "%s", startingPositionId: "%s"',
    tostring(trail.name), tostring(trail.pathId), tostring(trail.boundaryId), tostring(trail.startingPositionId)))
  local vehicleIdToUse = vehicleId > 0 and vehicleId or nil
  log('D', 'SetupCrawl', string.format('Calling bridge.setupCrawl with vehicleId: %s', tostring(vehicleIdToUse)))
  if self.bridge.setupCrawl(vehicleIdToUse, trail) then
@/lua/ge/extensions/editor/decalSpline.lua
          local flag = i == selectedSplineIdx
          if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            selectedSplineIdx = i
          else
            if im.InputText("###" .. tostring(wCtr), splineNamePtr, 32) then
              local preState = splineMgr.deepCopyDecalSpline(spline)
        for _, compIdx in ipairs(enabledComponents) do
          local tabName = "Comp "..tostring(compIdx)
          if im.BeginTabItem(tabName) then
            selectedComponentTab = compIdx
            local childName = "ComponentChild"..tostring(compIdx)
            im.PushStyleVar2(im.StyleVar_WindowPadding, im.ImVec2(4, 8))
@/lua/common/libs/LuaIRC/init.lua
    if res == nil then
        log('E', 'irc.init.connect', "irc connect error: " .. tostring(errmsg))
        return
    local function sub_print_r(t,indent)
        if (print_r_cache[tostring(t)]) then
            print(indent.."*"..tostring(t))
        if (print_r_cache[tostring(t)]) then
            print(indent.."*"..tostring(t))
        else
        else
            print_r_cache[tostring(t)]=true
            if (type(t)=="table") then
                    if (type(val)=="table") then
                        print(indent.."["..pos.."] => "..tostring(t).." {")
                        sub_print_r(val,indent..string.rep(" ",string.len(pos)+8))
                    else
                        print(indent.."["..pos.."] => "..tostring(val))
                    end
            else
                print(indent..tostring(t))
            end
    if (type(t)=="table") then
        print(tostring(t).." {")
        sub_print_r(t,"  ")
    else
        print('unknown command: ' .. tostring(cmd) .. ' : ')
        print_r(params)
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/countdownSynced.lua
    -- (plain numbers get treated as translation keys)
    local msgStr = tostring(msg)
    local msgForDisplay = msgStr
@/lua/common/jbeam/materials.lua
  else
    log("E", "material.init", tostring(err))
    return nop
      local meshStr = vehicleObj:getMeshesContainingMaterial(orgMat)
      --log('D', "material.init", "[glowmap] meshes containing material " .. orgMat .. ": " .. tostring(meshStr))
      local meshes = split(trim(meshStr), " ")
          table.insert(triggers, gmat)
          local switchName = tostring(orgMat) .. "|" .. tostring(mesh)
          --log('D', "material.init", "[glowmap] created materialSwitch '"..switchName.."' [" .. tostring(gmat.msc) .. "] for material " .. tostring(orgMat) .. " on mesh " .. mesh)
          table.insert(triggers, gmat)
          local switchName = tostring(orgMat) .. "|" .. tostring(mesh)
          --log('D', "material.init", "[glowmap] created materialSwitch '"..switchName.."' [" .. tostring(gmat.msc) .. "] for material " .. tostring(orgMat) .. " on mesh " .. mesh)
          local switchName = tostring(orgMat) .. "|" .. tostring(mesh)
          --log('D', "material.init", "[glowmap] created materialSwitch '"..switchName.."' [" .. tostring(gmat.msc) .. "] for material " .. tostring(orgMat) .. " on mesh " .. mesh)
          gmat.mesh = mesh
          local switchName = tostring(orgMat) .. "|" .. tostring(mesh)
          --log('D', "material.init", "[glowmap] created materialSwitch '"..switchName.."' [" .. tostring(gmat.msc) .. "] for material " .. tostring(orgMat) .. " on mesh " .. mesh)
          gmat.mesh = mesh
        else
          log("E", "material.init", "[glowmap] failed to create materialSwitch '" .. switchName .. "' for material " .. tostring(k) .. " on mesh " .. tostring(mesh))
        end
        else
          log("E", "material.init", "[glowmap] failed to create materialSwitch '" .. switchName .. "' for material " .. tostring(k) .. " on mesh " .. tostring(mesh))
        end

      --log('I', "material.init", "[deformgroup] meshes containing material " .. flexbody.deformMaterialBase .. ": " .. tostring(meshStr))
      --log('I', "material.init", "flexbody mesh '"..flexbody.mesh.."' contains the following materials: " .. dumps(vehicleObj:getMeshsMaterialsTbl(flexbody.mesh)))
        end
        local switchName = tostring(matName) .. "|" .. tostring(flexbody.mesh)
        local s = switches[switchName]
        end
        local switchName = tostring(matName) .. "|" .. tostring(flexbody.mesh)
        local s = switches[switchName]
          if s >= 0 then
          --log('I', "material.init", "[deformgroup] created materialSwitch '"..switchName.."' [" .. tostring(s) .. "] for material " .. tostring(matName) .. " on mesh " .. tostring(flexbody.mesh))
          end
          if s >= 0 then
          --log('I', "material.init", "[deformgroup] created materialSwitch '"..switchName.."' [" .. tostring(s) .. "] for material " .. tostring(matName) .. " on mesh " .. tostring(flexbody.mesh))
          end
          if s >= 0 then
          --log('I', "material.init", "[deformgroup] created materialSwitch '"..switchName.."' [" .. tostring(s) .. "] for material " .. tostring(matName) .. " on mesh " .. tostring(flexbody.mesh))
          end
        else
          --log('I', "material.init", "[deformgroup] reused materialSwitch '"..switchName.."' [" .. tostring(s) .. "] for material " .. tostring(matName) .. " on mesh " .. tostring(flexbody.mesh))
        end
        else
          --log('I', "material.init", "[deformgroup] reused materialSwitch '"..switchName.."' [" .. tostring(s) .. "] for material " .. tostring(matName) .. " on mesh " .. tostring(flexbody.mesh))
        end
        else
          --log('I', "material.init", "[deformgroup] reused materialSwitch '"..switchName.."' [" .. tostring(s) .. "] for material " .. tostring(matName) .. " on mesh " .. tostring(flexbody.mesh))
        end
        else
          log("W", "material.init", "[deformgroup] failed to create materialSwitch '" .. switchName .. "' for material " .. tostring(matName) .. " on mesh " .. tostring(flexbody.mesh))
        end
        else
          log("W", "material.init", "[deformgroup] failed to create materialSwitch '" .. switchName .. "' for material " .. tostring(matName) .. " on mesh " .. tostring(flexbody.mesh))
        end
@/lua/ge/extensions/editor/tech/roadArchitect/decals.lua
      dRoad:setField("autoLanes", 0, "false")
      dRoad:setField("oneWay", 0, tostring(section.isOneWay))
      dRoad:setField("lanesLeft", 0, section.lanesL)
@/gameplay/tutorials/customNodes/registerLocationsNode.lua
    {
      pos = self.pinIn["pos" .. tostring(i)].value,
      rot = self.pinIn["rot" .. tostring(i)].value,
      pos = self.pinIn["pos" .. tostring(i)].value,
      rot = self.pinIn["rot" .. tostring(i)].value,
      id = i,
      desc = {
        name = self.pinIn["name" .. tostring(i)].value,
        type = self.pinIn["type" .. tostring(i)].value,
        name = self.pinIn["name" .. tostring(i)].value,
        type = self.pinIn["type" .. tostring(i)].value,
        desc = self.pinIn["desc" .. tostring(i)].value,
        type = self.pinIn["type" .. tostring(i)].value,
        desc = self.pinIn["desc" .. tostring(i)].value,
      }
@/lua/common/libs/xlsxlib/tests/TestManager.lua
      else
        log('E', '', 'Unknown test function: ' .. tostring(name))
      end
        else
          log('E', '', ' - ' .. displayName .. " >>> FAILED: " .. tostring(err))
        end

    log('I', '', "Test PASS count: " .. tostring(self.__internal.testPassCount))
    if self.__internal.testFailCount > 0 then
    if self.__internal.testFailCount > 0 then
      log('I', '', "Test FAIL count: " .. tostring(self.__internal.testFailCount))
    end
@/lua/ge/extensions/flowgraph/nodes/scene/spawnLight.lua

  object:setField('innerAngle', 0, tostring(self.pinIn.innerAngle.value))
  object:setField('outerAngle', 0, tostring(self.pinIn.outerAngle.value))
  object:setField('innerAngle', 0, tostring(self.pinIn.innerAngle.value))
  object:setField('outerAngle', 0, tostring(self.pinIn.outerAngle.value))
  object:setField('brightness', 0, tostring(self.pinIn.brightness.value))
  object:setField('outerAngle', 0, tostring(self.pinIn.outerAngle.value))
  object:setField('brightness', 0, tostring(self.pinIn.brightness.value))
  object:setField('range', 0, tostring(self.pinIn.range.value))
  object:setField('brightness', 0, tostring(self.pinIn.brightness.value))
  object:setField('range', 0, tostring(self.pinIn.range.value))
  -- name will be generated to avoid duplicate names
  local name = "light_" .. tostring(os.time()) .. "_" .. self.id..'_'.. #self.objects .. '_' .. counter
  counter = counter+1

    object:setField('innerAngle', 0, tostring(self.pinIn.innerAngle.value))
    object:setField('outerAngle', 0, tostring(self.pinIn.outerAngle.value))
    object:setField('innerAngle', 0, tostring(self.pinIn.innerAngle.value))
    object:setField('outerAngle', 0, tostring(self.pinIn.outerAngle.value))
    object:setField('brightness', 0, tostring(self.pinIn.brightness.value))
    object:setField('outerAngle', 0, tostring(self.pinIn.outerAngle.value))
    object:setField('brightness', 0, tostring(self.pinIn.brightness.value))
    object:setField('range', 0, tostring(self.pinIn.range.value))
    object:setField('brightness', 0, tostring(self.pinIn.brightness.value))
    object:setField('range', 0, tostring(self.pinIn.range.value))
@/lua/ge/extensions/editor/gen/mesh.lua
	if not space then space = 0 end
	U.dump(m, '?? align:'..tostring(pfr)..':'..tostring(pto))
--    to()
	if not space then space = 0 end
	U.dump(m, '?? align:'..tostring(pfr)..':'..tostring(pto))
--    to()
	local mtx = MatrixF(true)
--		lo('?? to_POS:'..tostring(pos))
	if not daedesc or not daedesc.len then
		lo('!! ERR_fillSegment_NOLEN:'..tostring(daedesc))
		return
	local n = math.floor(l/daedesc.len + 0.5)
--		if dbg then lo('??^^^^^^^^^^^^^ fS:'..tostring(daedesc.len)..' n:'..n) end
	if n == 0 then n = 1 end
	local vscale = vec3(1,1,1) + dir*sc
--		U.dump(daedesc, '?? fillSegment:'..l..':'..tostring(b-a)..':'..daedesc.len..':'..n..' scale:'..scale) --..tostring(M.fdata))
	local ang = U.vang(U.vturn(b-a, math.pi/2), daedesc.front, true)
	local vscale = vec3(1,1,1) + dir*sc
--		U.dump(daedesc, '?? fillSegment:'..l..':'..tostring(b-a)..':'..daedesc.len..':'..n..' scale:'..scale) --..tostring(M.fdata))
	local ang = U.vang(U.vturn(b-a, math.pi/2), daedesc.front, true)
	local ang = U.vang(U.vturn(b-a, math.pi/2), daedesc.front, true)
--		lo('??++++++++++++++ fillSegment_FRONT:'..tostring(daedesc.front)..' ang:'..ang..' n:'..n..' sacle:'..scale)
--		U.out.aset[1] = {set = }
--		scale = 0.5
--		U.dump(daedesc,'?? for_N:'..n..':'..step..'/'..(b-a):length()..':'..tostring(vscale)..' l:'..l)
	for i = 1,n do
		local pos = a + e*step*(i-1)
--			if dbg then lo('?? fS_pos:'..tostring(pos)) end
		local itm = M.to(daedesc, pos, vec3(0,0,ang+turn), vscale) -- vec3(scale,1,1))
		if dbg then
			U.dump(base, '?? uv4poly:'..tostring(u)..':'..tostring(v)..':'..tostring(w)..' ref:'..tostring(ref), true)
		end
		if dbg then
			U.dump(base, '?? uv4poly:'..tostring(u)..':'..tostring(v)..':'..tostring(w)..' ref:'..tostring(ref), true)
		end
		if dbg then
			U.dump(base, '?? uv4poly:'..tostring(u)..':'..tostring(v)..':'..tostring(w)..' ref:'..tostring(ref), true)
		end
		if dbg then
			U.dump(base, '?? uv4poly:'..tostring(u)..':'..tostring(v)..':'..tostring(w)..' ref:'..tostring(ref), true)
		end
	vn = vn or (a-b):cross(c-b):normalized()
--        lo('?? forNorm:'..tostring(vn))
	local a = U.vang(vn,vec3(0,0,1))
	end
--            U.dump(uvini, '?? ref:'..tostring(ref)..':'..tostring(refuv)..':'..tostring(sideuv))
	local u = side:normalized()
	end
--            U.dump(uvini, '?? ref:'..tostring(ref)..':'..tostring(refuv)..':'..tostring(sideuv))
	local u = side:normalized()
	end
--            U.dump(uvini, '?? ref:'..tostring(ref)..':'..tostring(refuv)..':'..tostring(sideuv))
	local u = side:normalized()

--        lo('?? forUV_uv:'..tostring(u)..':'..tostring(v))

--        lo('?? forUV_uv:'..tostring(u)..':'..tostring(v))
      w = (base[i+1] - base[i]):normalized():cross(a)
--          lo('?? forBeam_w:'..tostring(w))
      if w:length() > U.small_val then break end
  end
--		  U.dump(base,'>> forBeam:'..tostring(L)..':'..tostring(w))
  if not w then return end
  end
--		  U.dump(base,'>> forBeam:'..tostring(L)..':'..tostring(w))
  if not w then return end
]]
--        lo('?? if_NORM:'..tostring(av[ai[1]])..':'..tostring(av[ai[2]])..':'..tostring(av[ai[3]])..':'..tostring((av[ai[1]]-av[ai[2]]):cross(av[ai[3]]-av[ai[2]]):normalized()))
	local akey,vn = forNorm(av[ai[1]], av[ai[2]], av[ai[3]])
]]
--        lo('?? if_NORM:'..tostring(av[ai[1]])..':'..tostring(av[ai[2]])..':'..tostring(av[ai[3]])..':'..tostring((av[ai[1]]-av[ai[2]]):cross(av[ai[3]]-av[ai[2]]):normalized()))
	local akey,vn = forNorm(av[ai[1]], av[ai[2]], av[ai[3]])
]]
--        lo('?? if_NORM:'..tostring(av[ai[1]])..':'..tostring(av[ai[2]])..':'..tostring(av[ai[3]])..':'..tostring((av[ai[1]]-av[ai[2]]):cross(av[ai[3]]-av[ai[2]]):normalized()))
	local akey,vn = forNorm(av[ai[1]], av[ai[2]], av[ai[3]])
]]
--        lo('?? if_NORM:'..tostring(av[ai[1]])..':'..tostring(av[ai[2]])..':'..tostring(av[ai[3]])..':'..tostring((av[ai[1]]-av[ai[2]]):cross(av[ai[3]]-av[ai[2]]):normalized()))
	local akey,vn = forNorm(av[ai[1]], av[ai[2]], av[ai[3]])
--    if isnan(akey[1])
--            U.dump(akey, '??+++++++++++++++++++++++++ akey:'..tostring(vn)..':'..#an..':'..#av..':'..tostring(ai[1]))
	if not dnorm[akey[1]] then dnorm[akey[1]] = {} end
--    if isnan(akey[1])
--            U.dump(akey, '??+++++++++++++++++++++++++ akey:'..tostring(vn)..':'..#an..':'..#av..':'..tostring(ai[1]))
	if not dnorm[akey[1]] then dnorm[akey[1]] = {} end

--		lo('?? ifizn:'..tostring(isnan(an))..':'..tostring(an)..':'..type(1)..':'..type({}))
	local inorm = type(an) == 'table' and dnorm[akey[1]][akey[2]] or an

--		lo('?? ifizn:'..tostring(isnan(an))..':'..tostring(an)..':'..type(1)..':'..type({}))
	local inorm = type(an) == 'table' and dnorm[akey[1]][akey[2]] or an
	if #base == 0 then return end
--		lo('>> zip2:'..tostring(an[1]))
	if not ai then
		for i,v in pairs(an) do
		--        lo('?? z3_n:'..i..':'..tostring(v))
			local akey,vn = forNorm(nil, nil, nil, v)
			local akey,vn = forNorm(nil, nil, nil, v)
		--          U.dump(akey, '?? zip2_akey:'..tostring(v))
			if not isnan(akey[1]) then
		--    if isnan(akey[1])
		--            U.dump(akey, '??+++++++++++++++++++++++++ akey:'..tostring(vn)..':'..#an..':'..#av..':'..tostring(ai[1]))
			if not dnorm[akey[1] ] then dnorm[akey[1] ] = {} end
		--    if isnan(akey[1])
		--            U.dump(akey, '??+++++++++++++++++++++++++ akey:'..tostring(vn)..':'..#an..':'..#av..':'..tostring(ai[1]))
			if not dnorm[akey[1] ] then dnorm[akey[1] ] = {} end
			if dbg then
				lo('?? zip2:'..tostring(base[ai[i]])..':'..tostring(base[ai[#ai-i]])..':'..tostring(base[ai[#ai-i+1]]))
			end
			if dbg then
				lo('?? zip2:'..tostring(base[ai[i]])..':'..tostring(base[ai[#ai-i]])..':'..tostring(base[ai[#ai-i+1]]))
			end
			if dbg then
				lo('?? zip2:'..tostring(base[ai[i]])..':'..tostring(base[ai[#ai-i]])..':'..tostring(base[ai[#ai-i+1]]))
			end
local function rect(u, v, av, af, pos, hasfront)
--            lo('?? rect:'..tostring(u)..':'..tostring(v))
	if av == nil then
local function rect(u, v, av, af, pos, hasfront)
--            lo('?? rect:'..tostring(u)..':'..tostring(v))
	if av == nil then
			if askip[i] ~= nil and askip[i][j] ~= nil then
--                lo('??_________ for_TYPE:'..tostring(type(skip[i][j])))
				toflip = type(askip[i][j]) == 'table' and askip[i][j][1] or false
					local astr = U.split(kid.kids[1].value, ' ')
					lo('?? xml2mesh.VNU:'..lvl..':'..kid.attr.id..':'..#astr..'/'..tostring(kid.attr.count)..':'..tostring(ingeo))
					if ingeo ~= nil then
					local astr = U.split(kid.kids[1].value, ' ')
					lo('?? xml2mesh.VNU:'..lvl..':'..kid.attr.id..':'..#astr..'/'..tostring(kid.attr.count)..':'..tostring(ingeo))
					if ingeo ~= nil then
			elseif ({polylist = 1, triangles = 1})[kid.name] ~= nil then
					lo('?______ for_aint:'..#kid.kids..':'..tostring(kid.attr.count))
				for _,k in pairs(kid.kids) do
						local astr = U.split(k.kids[1].value, ' ')
						lo('?? xml2mesh.FACES:'..tostring(kid.attr.material)..':'..#astr..':'..kid.attr.count..' step:'..(#astr/kid.attr.count))
--                        lo('?? vkid:'..#k.kids..':'..#astr)
				cgeom = cgeom + 1
				lo('??**** IN_GEO:'..cgeom..':'..kid.attr.id..':'..tostring(ageom[cgeom]))
				ingeo = kid.attr.id
				if #kid.kids > 0 then
					lo('?? toKids.VNU:'..cfloat..':'..kid.attr.id..':'..tostring(ingeo)..':'..#ageom[cgeom].verts) --..':'..#astr..':'..tostring(ingeo))
					local list,step,count
				if #kid.kids > 0 then
					lo('?? toKids.VNU:'..cfloat..':'..kid.attr.id..':'..tostring(ingeo)..':'..#ageom[cgeom].verts) --..':'..#astr..':'..tostring(ingeo))
					local list,step,count
						if a.name == 'count' then
							a.value = tostring(#list * step)
							lo('?? for_count:'..a.value)
					if k.name == 'p' then
						lo('?? toKids.FACES:'..tostring(kid.attr.material))--..':'..#astr)
						local str = ''
					if a.name == 'count' then
						a.value = tostring(#ageom[cgeom].faces * 3 / 9)
						lo('?? for_count_f:'..a.value)
				local astr = U.split(kid.kids[1].value, ' ')
				lo('??++++ FOF:'..#astr..':'..(astr[1]+1)) --..tostring(kid.kids[1].value))
			--                lo('?? FOF:'..tostring(#kid.kids[1]))
				lo('??++++ FOF:'..#astr..':'..(astr[1]+1)) --..tostring(kid.kids[1].value))
			--                lo('?? FOF:'..tostring(#kid.kids[1]))
				afloat[#afloat + 1] = astr
local function forNode(node, path, lvl, ind, dbg)
--		U.dump(path, '>> forNode:'..tostring(lvl)..':'..tostring(ind))
	if not lvl then lvl = 1 end
local function forNode(node, path, lvl, ind, dbg)
--		U.dump(path, '>> forNode:'..tostring(lvl)..':'..tostring(ind))
	if not lvl then lvl = 1 end
--				lo('?? forNode:'.._..':'..kid.name..'/'..path[lvl])
				if dbg then lo('?? for_KID:'.._..':'..tostring(kid.name)) end
			if kid.name == path[lvl] then
--					lo('?? forNode_match:'..nmatch..':'..ind..':'..lvl..':'..kid.name)
					if dbg then U.dump(path,'?? match:'..nmatch..'/'..tostring(ind)..':'..tableSize(node.kids)..':'..kid.name) end
				if ind == 0 and lvl==#path then
			if ind>0 and ((lvl == #path and nmatch == ind) or (lvl < #path and nmatch==1)) then
--					lo('?? forNode.found:'..tostring(path[lvl]))
				if lvl == #path then
	else
		lo('!! no_NODE:'..tostring(node)..':'..lvl..':'..tostring(path[lvl]))
	end
	else
		lo('!! no_NODE:'..tostring(node)..':'..lvl..':'..tostring(path[lvl]))
	end
	if #ad == 0 then return s end
--	s = tostring(ad[1])
--	s = s..'a'
--	s = s..'a'
--		lo('?? if_VEC:'..tostring(tostring(ad[1]))..':'..s)
	local isvec = string.find(tostring(ad[1]), 'vec3') == 1
--	s = s..'a'
--		lo('?? if_VEC:'..tostring(tostring(ad[1]))..':'..s)
	local isvec = string.find(tostring(ad[1]), 'vec3') == 1
--		lo('?? if_VEC:'..tostring(tostring(ad[1]))..':'..s)
	local isvec = string.find(tostring(ad[1]), 'vec3') == 1
--		lo('?? if_VEC:'..tostring(isvec))
	local isvec = string.find(tostring(ad[1]), 'vec3') == 1
--		lo('?? if_VEC:'..tostring(isvec))
	for _,d in pairs(ad) do
	local ndass = M.forNode(ndsrc, {'technique_common','accessor'})
	M.ofNode(nda, {count=tostring(count*stride)})
	M.text2node(nda, s)
	M.text2node(nda, s)
	M.ofNode(ndass, {count=tostring(count)})
end
--	ndmesh = deepcopy(ndmesh)
--		lo('?? for_mesh2:'..tostring(ndmesh)..':'..saf)
	-- put mesh data
	local nd = M.forNode(ndmesh, {'triangles'})
	M.ofNode(nd, {material=m.idmat, count=tostring(#m.faces/3)})
	nd = M.forNode(nd, {'p'})
	local ndass = M.forNode(ndmesh, {'source','technique_common','accessor'})
	M.ofNode(nda, {count=tostring(#m.verts*3)})
	M.text2node(nda, sav)
	M.text2node(nda, sav)
	M.ofNode(ndass, {count=tostring(math.floor(#m.verts))})
]]
		flexmesh:primitivesGet(primitives)
--                    lo('?? FM:'..i..':'..tostring(flexmesh.meshName)..':'..flexmesh.primitivesCount)
		for primI = 0, (flexmesh.primitivesCount - 1 ) do
--				lo('?? for_S:'..s)
--                            dump(bag, '?? AVP:'..tableSize(bag)..':'..tableSize(avp)..':'..tostring(avp[1]))
--					lo('?? for_AFP:'..#afp..'/'..(endIndex-startIndex+1))
--                if #U.index({'rb8r_rb8rr','b3ll_rf1l'},b.stamp) > 0 then
--					U.dump(b, '?? mas:'..b.stamp..':'..tostring(madef)..':'..tostring(maspr)..':'..tostring(mastr))
--				end
--                if #U.index({'rb8r_rb8rr','b3ll_rf1l'},b.stamp) > 0 then
--					U.dump(b, '?? mas:'..b.stamp..':'..tostring(madef)..':'..tostring(maspr)..':'..tostring(mastr))
--				end
--                if #U.index({'rb8r_rb8rr','b3ll_rf1l'},b.stamp) > 0 then
--					U.dump(b, '?? mas:'..b.stamp..':'..tostring(madef)..':'..tostring(maspr)..':'..tostring(mastr))
--				end
--[[
			lo('?? for_beam:'..i..':'..tostring(b.partOrigin))
			if string.find(b.partOrigin, 'pickup_radiator') then
--			c[#c+1] = alpha
		local nm,mo = M.matUp(tostring(i), c)
--		dgeo[m.name] = {name=m.name,m=m,mat={nm=nm, body=mo, c=c},sel=false}
		mat[#mat+1] = 0.4
		local nm,mo = M.matUp(tostring(i), mat)
--		amat[nm] =
		for i,k in pairs(ndmat.kids) do
	--			lo('?? if_MAT:'..i..':'..tostring(k.name))
			if k.name == 'material' then
				c[4] = 0.3
				local nm,mo = M.matUp(tostring(#amat+1), c)
				amat[#amat+1] = {nm=nm, body=mo, c=c}
				amat[#amat+1] = {nm=nm, body=mo, c=c}
--					U.dump(amat[#amat],'?? for_MAT:'..#amat..':'..tostring(mo))
--					lo('?? for_mat:'..tostring(m.material))
--					U.dump(amat[#amat],'?? for_MAT:'..#amat..':'..tostring(mo))
--					lo('?? for_mat:'..tostring(m.material))
				dgeo[k.attr['id']][#dgeo[k.attr['id']]+1] = {
--			dgeo[k.attr['name']] = {m=m, mat=amat[U.mod(gind,#abin)]}
--				lo('?? for_MAT:'..amat[gind].nm..':'..tostring(amat[gind].body:getField('diffuseColor',0)))
			gind = gind + 1
	local lvs = M.forNode(main, {'COLLADA','library_visual_scenes'})
--		U.dump(dgeo,'??_______________________________ for_LVS:'..tostring(lvs),nil,1)
	local out = {}
	M.forChild(lvs, 'instance_geometry', function(k)
--			lo('?? for_INST:'..tostring(k.parent.attr.name))
		local s = string.sub(k.attr.url,2)
			out[#out].list = dgeo[s]
--			lo('?? hit:'..tostring(s)..':'..tostring(k.attr.name))
			local area,nface = 0,0
			out[#out].list = dgeo[s]
--			lo('?? hit:'..tostring(s)..':'..tostring(k.attr.name))
			local area,nface = 0,0
--[[
					U.dump(acell, '??^^^^^^^^^^^^^^^^^ if_MATRIX:'..tostring(mnode)..':'..tostring(mnode.kids[1].value))
				local mtx = MatrixF(true)
--[[
					U.dump(acell, '??^^^^^^^^^^^^^^^^^ if_MATRIX:'..tostring(mnode)..':'..tostring(mnode.kids[1].value))
				local mtx = MatrixF(true)
				local pos = vec3(acell[4],acell[8],acell[12])
					lo('?? for_mat:'..tostring(pos))
				out[#out].pos = pos
M.geoFrom = function(nd, dmat) --dmat)
		lo('>> geoFrom:'..nd.name..':'..tostring(nd.attr['name']))--..':'..tostring(mat))
		local dbg = false -- string.find(tostring(nd.attr['name']),'Colmesh') == 1
M.geoFrom = function(nd, dmat) --dmat)
		lo('>> geoFrom:'..nd.name..':'..tostring(nd.attr['name']))--..':'..tostring(mat))
		local dbg = false -- string.find(tostring(nd.attr['name']),'Colmesh') == 1
		lo('>> geoFrom:'..nd.name..':'..tostring(nd.attr['name']))--..':'..tostring(mat))
		local dbg = false -- string.find(tostring(nd.attr['name']),'Colmesh') == 1
	-- get semantics
		if k.name == 'input' then
--				lo('?? for_k_ATTR:'..k.attr['source']..':'..tostring(k.attr.semantic))
--				U.dump(k.attr,'?? for_ATTR:'..tostring(k.attr.semantic))
--				lo('?? for_k_ATTR:'..k.attr['source']..':'..tostring(k.attr.semantic))
--				U.dump(k.attr,'?? for_ATTR:'..tostring(k.attr.semantic))
			dsem[k.attr['source']:sub(2)] = k.attr.semantic
		ndtri = forNode(nd, {'mesh','triangles'}, nil, ntri)
			lo('?? for_RTIANG:'..ntri..':'..tostring(ndtri))
	end
		if k.name == 'input' then
--			lo('?? kid_name:'..i..':'..tostring(k.name)..':'..tostring(k.attr.semantic))
			dsem[k.attr['source']:sub(2)] = k.attr.semantic
		if k.name == 'input' then
--			lo('?? kid_name:'..i..':'..tostring(k.name)..':'..tostring(k.attr.semantic))
			dsem[k.attr['source']:sub(2)] = k.attr.semantic
		if (not count and not forfaces) then count = fa.attr.count/stride end
--			lo('?? count:'..tostring(count))
		local av = {}
	-- get faces
--		lo('?? if_TRI:'..tostring(forNode(ndtri, {'p'}).kids[1].value))
	local stride = 0
		end
			U.dump(dmat, '?? geoFrom_mat:'..tostring(t.attr.material))
		for k,v in pairs(dmat) do
		for k,v in pairs(dmat) do
			if string.find(k,tostring(t.attr.material),1,true) == 1 then
				mat = v
		if not mat then mat = t.attr.material end
--			lo('?? if_MAT:'..tostring(t.attr.material))
		am[#am+1] = {
M.toDAE = function(am, pth)
		lo('?? M.toDAE:'..tostring(#am)..':'..tostring(pth))
	-- build DAE frame
M.toDAE = function(am, pth)
		lo('?? M.toDAE:'..tostring(#am)..':'..tostring(pth))
	-- build DAE frame
--	local xmain = M.xmlOn(editor.getLevelPath()..'bat/'..'emat_template.dae') --pth)
--		lo('?? if_xmain:'..#am..':'..tostring(xmain))
--	local inspect = require("libs/inspect/inspect")
--		local v = vec3(1,2,3)
--		lo('?? if_v:'..tostring(v))
--		U.dump(v, '?? if_v:')
	local ndass = M.forNode(ndmesh, {'mesh','source','technique_common','accessor'})
	M.ofNode(nda, {count=tostring(#av)})
	M.text2node(nda, sv)
	M.text2node(nda, sv)
	M.ofNode(ndass, {count=tostring(math.floor(#av/3))})
	-- normals info

	M.ofNode(nda, {count=tostring(#an)})
	M.text2node(nda, sn)
	M.text2node(nda, sn)
	M.ofNode(ndass, {count=tostring(math.floor(#an/3))})
	-- UV info
	nd = M.forNode(ndmesh, {'source'}, 1, 3)
--						lo('?? if_NODE_UV:'..tostring(nda))
	nda = M.forNode(nd, {'float_array'})
	ndass = M.forNode(nd, {'technique_common','accessor'})
--						lo('?? if_NODE_UV2:'..tostring(nda)..':'..tostring(ndass))
	M.ofNode(nda, {count=tostring(#auv)})
	ndass = M.forNode(nd, {'technique_common','accessor'})
--						lo('?? if_NODE_UV2:'..tostring(nda)..':'..tostring(ndass))
	M.ofNode(nda, {count=tostring(#auv)})
--						lo('?? if_NODE_UV2:'..tostring(nda)..':'..tostring(ndass))
	M.ofNode(nda, {count=tostring(#auv)})
	M.text2node(nda, suv)
	M.text2node(nda, suv)
	M.ofNode(ndass, {count=tostring(math.floor(#auv/2))})
	-- triangles
	nda = M.forNode(ndmesh, {'triangles'})
	M.ofNode(nda, {count=tostring(#af/3/3)})
	ndass = M.forNode(nda, {'p'})
		for j,w in pairs(f.awall) do
--								lo('?? for_V:'..ii..':'..j..':'..tostring(w.pos))
			local ind = math.floor(#av/3)
	local ndass = M.forNode(xlod, {'COLLADA','library_geometries','geometry','mesh','source','technique_common','accessor'})
	M.ofNode(nda, {count=tostring(#av)})
	M.text2node(nda, sv)
	M.text2node(nda, sv)
	M.ofNode(ndass, {count=tostring(math.floor(#av/3))})
	-- normals info

	M.ofNode(nda, {count=tostring(#an)})
	M.text2node(nda, sn)
	M.text2node(nda, sn)
	M.ofNode(ndass, {count=tostring(math.floor(#an/3))})
	-- UV info
	nd = M.forNode(xlod, {'COLLADA','library_geometries','geometry','mesh','source'}, 1, 3)
--						lo('?? if_NODE_UV:'..tostring(nda))
	nda = M.forNode(nd, {'float_array'})
	ndass = M.forNode(nd, {'technique_common','accessor'})
--						lo('?? if_NODE_UV2:'..tostring(nda)..':'..tostring(ndass))
	M.ofNode(nda, {count=tostring(#auv)})
	ndass = M.forNode(nd, {'technique_common','accessor'})
--						lo('?? if_NODE_UV2:'..tostring(nda)..':'..tostring(ndass))
	M.ofNode(nda, {count=tostring(#auv)})
--						lo('?? if_NODE_UV2:'..tostring(nda)..':'..tostring(ndass))
	M.ofNode(nda, {count=tostring(#auv)})
	M.text2node(nda, suv)
	M.text2node(nda, suv)
	M.ofNode(ndass, {count=tostring(math.floor(#auv/2))})
	-- triangles
	nda = M.forNode(xlod, {'COLLADA','library_geometries','geometry','mesh','triangles'})
	M.ofNode(nda, {count=tostring(#af/3/3)})
	ndass = M.forNode(nda, {'p'})
	local pos = desc.pos + vec3(0,0,H)
		lo('?? if_POS:'..tostring(floor.pos)..':'..tostring(desc.pos))
	for i=1,#avt do
	local pos = desc.pos + vec3(0,0,H)
		lo('?? if_POS:'..tostring(floor.pos)..':'..tostring(desc.pos))
	for i=1,#avt do
	local nd_lod = deepcopy(template)
	dist = tostring(dist)
	M.ofNode(nd_lod, {id='e_lod_1_L'..dist, name='e_lod.1_L'..dist, type='NODE'})
	)
--		lo('?? if_IG:'..tostring(nd_ig)..':'..tostring(nd.id))
	return nd_lod
	)
--		lo('?? if_IG:'..tostring(nd_ig)..':'..tostring(nd.id))
	return nd_lod
	end
		lo('?? xmlOn:'..tostring(fname))
	local outputFile = io.open(fname, "w")
--        lo('?? matSet3:'..tostring(outputFile))
	if outputFile then
	if outputFile then
--			lo('?? xml2file:'..tostring(fname))
--      U.lo('?? pres2:'..tostring(doc.root))
--			lo('?? xml2file:'..tostring(fname))
--      U.lo('?? pres2:'..tostring(doc.root))
		local xmlstr = slaxdom:xml(xml.root)
		local xmlstr = slaxdom:xml(xml.root)
--      U.lo('?? pres3:'..tostring(xmlstr))
		outputFile:write('\n'..xmlstr)
--    local afloat = {}
--    if dbg then U.lo('>> kidsList:'..lvl..':'..tostring(node.kids and #node.kids or nil)..'>'..tostring(prop)) end
  	local idel = {}
--    local afloat = {}
--    if dbg then U.lo('>> kidsList:'..lvl..':'..tostring(node.kids and #node.kids or nil)..'>'..tostring(prop)) end
  	local idel = {}
		end
--        if dbg then U.lo('?? kid_name:'..tostring(kid.name)) end
--[[
				local astr = U.split(kid.kids[1].value, ' ')
				lo('??++++ FOF:'..#astr..':'..(astr[1]+1)) --..tostring(kid.kids[1].value))
--                lo('?? FOF:'..tostring(#kid.kids[1]))
				lo('??++++ FOF:'..#astr..':'..(astr[1]+1)) --..tostring(kid.kids[1].value))
--                lo('?? FOF:'..tostring(#kid.kids[1]))
				afloat[#afloat + 1] = astr
		local astr = U.split(kid.kids[1].value, ' ')
--                lo('??++++ FOF:'..#astr..':'..(astr[1]+1)) --..tostring(kid.kids[1].value))
	--                lo('?? FOF:'..tostring(#kid.kids[1]))
--                lo('??++++ FOF:'..#astr..':'..(astr[1]+1)) --..tostring(kid.kids[1].value))
	--                lo('?? FOF:'..tostring(#kid.kids[1]))
		afloat[#afloat + 1] = astr
								if not aind then
									U.lo('?? mat_REPL:'..tostring(a.value)..'>'..tostring(val))
									a.value = val
								if not aind then
									U.lo('?? mat_REPL:'..tostring(a.value)..'>'..tostring(val))
									a.value = val
		for i,a in ipairs(kid.attr) do
--                    lo('?? for_attr:'..i..':'..tostring(a.name))
--[[
	end
--        U.lo('?? pre_NEXT:'..tostring(kid))
	local goon = kidsList(kid, lvl + 1, prop, aind, val, dbg)
	local cmat = scenetree.findObject(nm)
--		lo('?? matUp:'..cs..':'..tostring(nm)..':'..tostring(cmat))
	if cmat then cmat:delete() end
	local cmat = scenetree.findObject(nm)
--		lo('?? matUp:'..cs..':'..tostring(nm)..':'..tostring(cmat))
	if cmat then cmat:delete() end
--	editor.setMaterialProperty(mat, 'translucentBlendOp', 0, 'Sub')
--		lo('?? if_mat:'..tostring(scenetree.findObject(nm))..':'..mat:getField("translucentBlendOp", 0))
--	for t,c in pairs({orange='1 0.5 0 1', green='0 1 0 1', blue='0 0 1 1',yellow='1 1 0 1'}) do
M.matReplace = function(fname, mat)
      U.lo('>> matReplace:'..tostring(fname))
--      print('>> matReplace:'..tostring(slaxml))
      U.lo('>> matReplace:'..tostring(fname))
--      print('>> matReplace:'..tostring(slaxml))
	if not slaxml then return end
--  local doc = kidsList(node, 1, 'material', {1,2,3,4,5}, mat, true)
--      U.lo('?? pres:'..tostring(doc))
--  fname = '/tmp/bat/to.dae'
	local outputFile = io.open(fname, "w")
--        lo('?? matSet3:'..tostring(outputFile))
	if outputFile then
	if outputFile then
--      U.lo('?? pres2:'..tostring(doc.root))
		local xmlstr = slaxdom:xml(node.root)
		local xmlstr = slaxdom:xml(node.root)
--      U.lo('?? pres3:'..tostring(xmlstr))
		outputFile:write('\n'..xmlstr)
	local outputFile = io.open(fname, "w")
--        lo('?? matSet3:'..tostring(outputFile))
	if outputFile then
local function save(ageom, fname) -- doc, fname)
		lo('>> save:'..#ageom..':'..tostring(doctemplate))
	fname = '/assets/_out/'..fname..'.dae'
	local av = mdata.verts
		lo('>> dissect:'..tostring(pos)..' dir:'..tostring(dir))
	local function forSimplex(i,j,mi,ma)
	local av = mdata.verts
		lo('>> dissect:'..tostring(pos)..' dir:'..tostring(dir))
	local function forSimplex(i,j,mi,ma)
		if d < U.small_dist then
				lo(i..':'..mi..':'..ma..':'..d..':'..s..' pos2:'..tostring(pos2)..' dir2:'..tostring(dir2))
			if s < mi then
		if d < U.small_dist then
				lo(i..':'..mi..':'..ma..':'..d..':'..s..' pos2:'..tostring(pos2)..' dir2:'..tostring(dir2))
			if s < mi then
	end
		lo('?? dirIn:'..tostring(mi)..':'..ma)
end
				}
lo('??___ to_MESH:'..key..':'..i..':'..tostring(#amesh[#amesh].verts)..':'..tostring(#amesh[#amesh].normals)..':'..tostring(#amesh[#amesh].uvs)..':'..tostring(#amesh[#amesh].faces))
			end
				}
lo('??___ to_MESH:'..key..':'..i..':'..tostring(#amesh[#amesh].verts)..':'..tostring(#amesh[#amesh].normals)..':'..tostring(#amesh[#amesh].uvs)..':'..tostring(#amesh[#amesh].faces))
			end
				}
lo('??___ to_MESH:'..key..':'..i..':'..tostring(#amesh[#amesh].verts)..':'..tostring(#amesh[#amesh].normals)..':'..tostring(#amesh[#amesh].uvs)..':'..tostring(#amesh[#amesh].faces))
			end
				}
lo('??___ to_MESH:'..key..':'..i..':'..tostring(#amesh[#amesh].verts)..':'..tostring(#amesh[#amesh].normals)..':'..tostring(#amesh[#amesh].uvs)..':'..tostring(#amesh[#amesh].faces))
			end
	end
--            lo('?? vrts:'..tostring(verts[1])..':'..tostring(m.verts[dvi[avi[1]]]))
	for o,i in pairs(ani) do
	end
--            lo('?? vrts:'..tostring(verts[1])..':'..tostring(m.verts[dvi[avi[1]]]))
	for o,i in pairs(ani) do
		for _,f in pairs(m.faces) do
--                    U.dump(f, '?? for_f:'.._..':'..tostring(dvi[f.v])..':'..tostring(dni[f.n])..':'..tostring(duvi[f.u]))
			afaces[ord][#afaces[ord]+1] = {v = dvi[f.v]-1, n = dni[f.n]-1, u = duvi[f.u]-1}
		for _,f in pairs(m.faces) do
--                    U.dump(f, '?? for_f:'.._..':'..tostring(dvi[f.v])..':'..tostring(dni[f.n])..':'..tostring(duvi[f.u]))
			afaces[ord][#afaces[ord]+1] = {v = dvi[f.v]-1, n = dni[f.n]-1, u = duvi[f.u]-1}
		for _,f in pairs(m.faces) do
--                    U.dump(f, '?? for_f:'.._..':'..tostring(dvi[f.v])..':'..tostring(dni[f.n])..':'..tostring(duvi[f.u]))
			afaces[ord][#afaces[ord]+1] = {v = dvi[f.v]-1, n = dni[f.n]-1, u = duvi[f.u]-1}
		if list == nil then
				lo('?? move:'..tostring(fr[ord].material)..':'..tostring(to[ord].material))
			if mat == nil and fr[ord].material ~= to[ord].material then
		if list == nil then
				lo('?? move:'..tostring(fr[ord].material)..':'..tostring(to[ord].material))
			if mat == nil and fr[ord].material ~= to[ord].material then
--                if dbg then
--                    lo('?? for_hit:'..i..' d:'..tostring(d)..':'..tostring(av[m.faces[i].v+1])..':'..tostring(av[m.faces[i+1].v+1])..':'..tostring(av[m.faces[i+2].v+1]))
--                end
--                if dbg then
--                    lo('?? for_hit:'..i..' d:'..tostring(d)..':'..tostring(av[m.faces[i].v+1])..':'..tostring(av[m.faces[i+1].v+1])..':'..tostring(av[m.faces[i+2].v+1]))
--                end
--                if dbg then
--                    lo('?? for_hit:'..i..' d:'..tostring(d)..':'..tostring(av[m.faces[i].v+1])..':'..tostring(av[m.faces[i+1].v+1])..':'..tostring(av[m.faces[i+2].v+1]))
--                end
--                if dbg then
--                    lo('?? for_hit:'..i..' d:'..tostring(d)..':'..tostring(av[m.faces[i].v+1])..':'..tostring(av[m.faces[i+1].v+1])..':'..tostring(av[m.faces[i+2].v+1]))
--                end
			end
				lo('?? to_pop:'..tostring(flip)..':'..imi..':'..#m.faces)
			triord = ord
			n = n + 1
--                lo('?? for_vert:'..n..':'..tostring(m.verts[f.v]))
		end
	end
		lo('?? pop:'..n..':'..tostring(center/n))
]]
--M.framePave = function(aloop, dir, step)
		lo('>> framePave:'..#aloop..':'..#astep..':'..tostring(dir)) --tostring(step))
		local sarg = {aloop=deepcopy(aloop),astep=deepcopy(astep)}
--M.framePave = function(aloop, dir, step)
		lo('>> framePave:'..#aloop..':'..#astep..':'..tostring(dir)) --tostring(step))
		local sarg = {aloop=deepcopy(aloop),astep=deepcopy(astep)}
			if dbg then
				lo('??_____________________________ edgeUp_DBG:'..tostring(stamp))
--				de['20_15'] = 0
--				de['20_15'] = 0
--				U.dump(de, '?? if_DE:'..tostring(de[stamp])..':'..stamp..':'..tostring(onloop))
--				return
--				de['20_15'] = 0
--				U.dump(de, '?? if_DE:'..tostring(de[stamp])..':'..stamp..':'..tostring(onloop))
--				return
			if dbg then
				lo('?? edgeUp:'..tostring(i)..':'..tostring(j)..':'..tostring(de[stamp])) --..':'..tostring(av[i].star)..':'..tostring(av[j].star))
--				U.dump(av[i].star, '?? STAR_i')
			if dbg then
				lo('?? edgeUp:'..tostring(i)..':'..tostring(j)..':'..tostring(de[stamp])) --..':'..tostring(av[i].star)..':'..tostring(av[j].star))
--				U.dump(av[i].star, '?? STAR_i')
			if dbg then
				lo('?? edgeUp:'..tostring(i)..':'..tostring(j)..':'..tostring(de[stamp])) --..':'..tostring(av[i].star)..':'..tostring(av[j].star))
--				U.dump(av[i].star, '?? STAR_i')
			if dbg then
				lo('?? edgeUp:'..tostring(i)..':'..tostring(j)..':'..tostring(de[stamp])) --..':'..tostring(av[i].star)..':'..tostring(av[j].star))
--				U.dump(av[i].star, '?? STAR_i')
			if dbg then
				lo('?? edgeUp:'..tostring(i)..':'..tostring(j)..':'..tostring(de[stamp])) --..':'..tostring(av[i].star)..':'..tostring(av[j].star))
--				U.dump(av[i].star, '?? STAR_i')
					if dbg then
						U.dump(anew, '?? edgeSplit3:'..tostring(stamp)..':'..tostring(p)..':'..tostring(p:distance(av[seg[1]].pos))..':'..tostring(ifr)..':'..seg[1])
						return
					if dbg then
						U.dump(anew, '?? edgeSplit3:'..tostring(stamp)..':'..tostring(p)..':'..tostring(p:distance(av[seg[1]].pos))..':'..tostring(ifr)..':'..seg[1])
						return
					if dbg then
						U.dump(anew, '?? edgeSplit3:'..tostring(stamp)..':'..tostring(p)..':'..tostring(p:distance(av[seg[1]].pos))..':'..tostring(ifr)..':'..seg[1])
						return
					if dbg then
						U.dump(anew, '?? edgeSplit3:'..tostring(stamp)..':'..tostring(p)..':'..tostring(p:distance(av[seg[1]].pos))..':'..tostring(ifr)..':'..seg[1])
						return
		for j,p in pairs(l) do
--					lo('?? for_loop:'..i..':'..j..':'..tostring(l[j]))
				l[j] = l[j] + 0*vec3(0.7,1.)
						local l,k = aloop[i][a],aloop[j][b]
	--						lo('?? for_LK:'..a..':'..b..':'..tostring(l)..':'..tostring(k))
	--			for a,l in pairs(aloop[i]) do
						local l,k = aloop[i][a],aloop[j][b]
	--						lo('?? for_LK:'..a..':'..b..':'..tostring(l)..':'..tostring(k))
	--			for a,l in pairs(aloop[i]) do
								local ang = U.vang(l.pos-U.mod(a+1,aloop[i]).pos, k.pos-U.mod(b+1,aloop[j]).pos, true)
--									lo('?? lCROSS:'..a..':'..b..':'..tostring(p)..':'..s..':'..#av..':'..tableSize(de)..':'..ang)
		--							lo('?? lCROSS:'..i..':'..j..':'..a..':'..b..':'..tostring(p)..':'..s..':'..ang..':'..#av..':'..tableSize(de))
--									lo('?? lCROSS:'..a..':'..b..':'..tostring(p)..':'..s..':'..#av..':'..tableSize(de)..':'..ang)
		--							lo('?? lCROSS:'..i..':'..j..':'..a..':'..b..':'..tostring(p)..':'..s..':'..ang..':'..#av..':'..tableSize(de))
								if hit then
			local p,s,iscolinear = U.line2seg(l[1],l[2],av[seg[1]].pos,av[seg[2]].pos,U.small_val)
--				lo('?? ifcross:'..tostring(av[seg[1]].pos))
--				if i == 3 then
--				if i == 3 then
--					lo('?? if_CROSS:'..tostring(s)..':'..tostring(iscolinear)..':'..stamp)
--				end
--				if i == 3 then
--					lo('?? if_CROSS:'..tostring(s)..':'..tostring(iscolinear)..':'..stamp)
--				end
			if s and not iscolinear then
--					lo('?? for_cross:'..i..':'..stamp..':'..tostring(p)..':'..tostring(s))
--				across[stamp] = (p-l[1]):dot(dir)
			if s and not iscolinear then
--					lo('?? for_cross:'..i..':'..stamp..':'..tostring(p)..':'..tostring(s))
--				across[stamp] = (p-l[1]):dot(dir)
								local ang = U.vang((av[frto[2] ].pos-av[frto[1] ].pos),dir,true)
									lo('??____ CHECK_inout:'..across[ii][1]..':'..ang..':'..tostring(ang>0)..':'..ii)
								if ang>0 then
								local ang = U.vang((av[frto[2]].pos-av[frto[1]].pos),dir,true)
									lo('??____ CHECK_inout:'..across[ii][1]..':'..ang..':'..tostring(ang>0)..':'..ii)
								if ang>0 then
--					U.dump(av,'?? for_AV_pre:'..tableSize(av)..'/'..#av)
--					lo('?? in_cross:'..j..':'..across[j][1]..':'..tostring(l[1]+dir*across[j][2]))
--					if dbg then lo('?? for_CROSS:'..j) end
		else
			U.dump(across, '!!^^^^^^^^^^^^^^^^^^^^^^^ WRONG_CROSS:'..i..':'..tostring(av[29].pos)..':'..tostring(av[30].pos))
--[[
		else
			U.dump(across, '!!^^^^^^^^^^^^^^^^^^^^^^^ WRONG_CROSS:'..i..':'..tostring(av[29].pos)..':'..tostring(av[30].pos))
--[[
			if j+1<=#across then
	--				lo('?? fr_to:'..across[i][1]..'>'..across[i+1][1]..':'..tostring(ind))
				edgeSplit(across[j+1][1], l[1]+dir*across[j+1][2], ind)
		for k,e in pairs(de) do
--				lo('?? for_LOOPS:'..N..':'..tostring(e))
			if e == 1 then
										av[ift[1]].pos,av[ift[2]].pos, U.small_val)
		--								if dbg then lo('?? if_HIT1:'..d[1]..':'..d[2]..'>'..k..':'..tostring(p1)) end
--										lo('?? preRS:'..tostring(av[d[2]])..':'..tostring(d[3])..':'..tostring(av[d[3]]))
		--								if dbg then lo('?? if_HIT1:'..d[1]..':'..d[2]..'>'..k..':'..tostring(p1)) end
--										lo('?? preRS:'..tostring(av[d[2]])..':'..tostring(d[3])..':'..tostring(av[d[3]]))
									if av[d[2]] and av[d[3]] then
		--								if dbg then lo('?? if_HIT1:'..d[1]..':'..d[2]..'>'..k..':'..tostring(p1)) end
--										lo('?? preRS:'..tostring(av[d[2]])..':'..tostring(d[3])..':'..tostring(av[d[3]]))
									if av[d[2]] and av[d[3]] then
		--								if dbg then lo('?? if_HIT1:'..d[1]..':'..d[2]..'>'..k..':'..tostring(p1)) end
--										lo('?? preRS:'..tostring(av[d[2]])..':'..tostring(d[3])..':'..tostring(av[d[3]]))
									if av[d[2]] and av[d[3]] then
											av[ift[1]].pos,av[ift[2]].pos, U.small_val)
			--								if dbg then lo('?? if_HIT2:'..d[3]..':'..d[2]..'>'..k..':'..tostring(p2)) end
				--								lo('?? p12:'..tostring(p1)..':'..tostring(p2))
			--								if dbg then lo('?? if_HIT2:'..d[3]..':'..d[2]..'>'..k..':'..tostring(p2)) end
				--								lo('?? p12:'..tostring(p1)..':'..tostring(p2))
			--								U.dump(d, '?? for_SPR1:'..tostring(p1)..':'..tostring(p2))
			--								if dbg then lo('?? if_HIT2:'..d[3]..':'..d[2]..'>'..k..':'..tostring(p2)) end
				--								lo('?? p12:'..tostring(p1)..':'..tostring(p2))
			--								U.dump(d, '?? for_SPR1:'..tostring(p1)..':'..tostring(p2))
				--								lo('?? p12:'..tostring(p1)..':'..tostring(p2))
			--								U.dump(d, '?? for_SPR1:'..tostring(p1)..':'..tostring(p2))
			--								U.dump(ift, '?? for_SPR2:')
				--								lo('?? p12:'..tostring(p1)..':'..tostring(p2))
			--								U.dump(d, '?? for_SPR1:'..tostring(p1)..':'..tostring(p2))
			--								U.dump(ift, '?? for_SPR2:')
										if p2 then
			--									U.dump(ift, '??________ HIT:'..k..':'..tostring(p2)..':'..tostring(av[d[3]].pos)..'>'..tostring(av[d[2]].pos)..':'..tostring(av[ift[1]].pos)..'>'..tostring(av[ift[2]].pos))
											local cd = p2:distance(av[d[2]].pos)
										if p2 then
			--									U.dump(ift, '??________ HIT:'..k..':'..tostring(p2)..':'..tostring(av[d[3]].pos)..'>'..tostring(av[d[2]].pos)..':'..tostring(av[ift[1]].pos)..'>'..tostring(av[ift[2]].pos))
											local cd = p2:distance(av[d[2]].pos)
										if p2 then
			--									U.dump(ift, '??________ HIT:'..k..':'..tostring(p2)..':'..tostring(av[d[3]].pos)..'>'..tostring(av[d[2]].pos)..':'..tostring(av[ift[1]].pos)..'>'..tostring(av[ift[2]].pos))
											local cd = p2:distance(av[d[2]].pos)
										if p2 then
			--									U.dump(ift, '??________ HIT:'..k..':'..tostring(p2)..':'..tostring(av[d[3]].pos)..'>'..tostring(av[d[2]].pos)..':'..tostring(av[ift[1]].pos)..'>'..tostring(av[ift[2]].pos))
											local cd = p2:distance(av[d[2]].pos)
										if p2 then
			--									U.dump(ift, '??________ HIT:'..k..':'..tostring(p2)..':'..tostring(av[d[3]].pos)..'>'..tostring(av[d[2]].pos)..':'..tostring(av[ift[1]].pos)..'>'..tostring(av[ift[2]].pos))
											local cd = p2:distance(av[d[2]].pos)
											local cd = p2:distance(av[d[2]].pos)
			--									if dbg then lo('?? if_HIT2:'..d[3]..':'..d[2]..'>'..k..':'..tostring(p2)..':'..cd) end
											if cd < dmi2 then
		--							if d[2] == 15 then
		--								U.dump(hit2,'?? pHIT15_:'..d1..':'..d2..':'..tostring(isplit)..':'..tostring(d1
		--							if d[2] == 15 then
		--								U.dump(hit2,'?? pHIT15_:'..d1..':'..d2..':'..tostring(isplit)..':'..tostring(d1
							inxt = next({aj[#aj-1],aj[#aj]})
--								lo('?? if_LOOP:'..stamp..':'..tostring(inxt))
							while inxt and inxt ~= aj[1] and N
		end
			if dbg then lo('?? for_N:'..N..':'..nloop..':'..tostring(done)) end
--			if N>100 then break end
--		local norm = ((avert[l[2]]-avert[l[1]]):cross(avert[l[#l]]-avert[l[1]])):normalized()
--			lo('?? for_NORM:'..tostring(norm))
		anorm[#anorm+1] = vec3(0,0,1)
--		U.dump(an, '?? AN:'..#an)
		lo('<< framePave:'..N..':'..tostring(u)..':'..w..' invalid:'..tostring(invalid))
		if U.out.f then
--		U.dump(an, '?? AN:'..#an)
		lo('<< framePave:'..N..':'..tostring(u)..':'..w..' invalid:'..tostring(invalid))
		if U.out.f then
									av[ind].pos,av[U.mod(j+1,ai)].pos)
		--								lo('?? p12:'..tostring(p1)..':'..tostring(p2))
								if p1 then
									av[ind].pos,av[U.mod(j+1,ai)].pos)
		--								lo('?? p12:'..tostring(p1)..':'..tostring(p2))
								if p1 then
								inxt = next({aj[#aj-1],aj[#aj]})
	--								lo('?? if_LOOP:'..stamp..':'..tostring(inxt))
								while inxt and inxt ~= aj[1] and N
			local stamp = U.stamp({i,start+U.mod(i+1-start,#l)})
--				U.lo('?? for_STAMP:'..stamp..':'..tostring(#U.index(aestamp,stamp))..':'..#aestamp)
			if #U.index(aestamp,stamp) == 0 then
				local p = U.line2seg(U.mod(k,loop), U.mod(k+1,loop),av[ae[ie][1]].p,av[ae[ie][2]].p)
	--                U.dump(ae[ie],'?? if_p:'..k..':'..i..':'..tostring(p)..':'..tostring(loop[k])..'>'..tostring(U.mod(k+1,loop))..':'..tostring(av[ae[ie][1]].p)..'>'..tostring(av[ae[ie][2]].p))
				if p and U.line2seg(av[ae[ie][1]].p, av[ae[ie][2]].p, U.mod(k,loop), U.mod(k+1,loop)) then
				local p = U.line2seg(U.mod(k,loop), U.mod(k+1,loop),av[ae[ie][1]].p,av[ae[ie][2]].p)
	--                U.dump(ae[ie],'?? if_p:'..k..':'..i..':'..tostring(p)..':'..tostring(loop[k])..'>'..tostring(U.mod(k+1,loop))..':'..tostring(av[ae[ie][1]].p)..'>'..tostring(av[ae[ie][2]].p))
				if p and U.line2seg(av[ae[ie][1]].p, av[ae[ie][2]].p, U.mod(k,loop), U.mod(k+1,loop)) then
				local p = U.line2seg(U.mod(k,loop), U.mod(k+1,loop),av[ae[ie][1]].p,av[ae[ie][2]].p)
	--                U.dump(ae[ie],'?? if_p:'..k..':'..i..':'..tostring(p)..':'..tostring(loop[k])..'>'..tostring(U.mod(k+1,loop))..':'..tostring(av[ae[ie][1]].p)..'>'..tostring(av[ae[ie][2]].p))
				if p and U.line2seg(av[ae[ie][1]].p, av[ae[ie][2]].p, U.mod(k,loop), U.mod(k+1,loop)) then
				local p = U.line2seg(U.mod(k,loop), U.mod(k+1,loop),av[ae[ie][1]].p,av[ae[ie][2]].p)
	--                U.dump(ae[ie],'?? if_p:'..k..':'..i..':'..tostring(p)..':'..tostring(loop[k])..'>'..tostring(U.mod(k+1,loop))..':'..tostring(av[ae[ie][1]].p)..'>'..tostring(av[ae[ie][2]].p))
				if p and U.line2seg(av[ae[ie][1]].p, av[ae[ie][2]].p, U.mod(k,loop), U.mod(k+1,loop)) then
				local p = U.line2seg(U.mod(k,loop), U.mod(k+1,loop),av[ae[ie][1]].p,av[ae[ie][2]].p)
	--                U.dump(ae[ie],'?? if_p:'..k..':'..i..':'..tostring(p)..':'..tostring(loop[k])..'>'..tostring(U.mod(k+1,loop))..':'..tostring(av[ae[ie][1]].p)..'>'..tostring(av[ae[ie][2]].p))
				if p and U.line2seg(av[ae[ie][1]].p, av[ae[ie][2]].p, U.mod(k,loop), U.mod(k+1,loop)) then
				if p and U.line2seg(av[ae[ie][1]].p, av[ae[ie][2]].p, U.mod(k,loop), U.mod(k+1,loop)) then
	--				U.dump(ae[ie],'?? HIT:'..tostring(i))
					return p,i
			local ib = onBoundary(loop[k])
--				U.lo('?? if_IN:'..i..':'..k..':'..tostring(U.inRC(b, {base}))..':'..tostring(ib))
			if ib then
			local ib = onBoundary(loop[k])
--				U.lo('?? if_IN:'..i..':'..k..':'..tostring(U.inRC(b, {base}))..':'..tostring(ib))
			if ib then
--				if i == 1 and k == 2 then
--					U.lo('?? if_bound:'..i..':'..k..':'..tostring(loop[k])..':'..#aebound..':'..tostring(ib))
--				if #aebound < 10 and i < 3 then
--				if i == 1 and k == 2 then
--					U.lo('?? if_bound:'..i..':'..k..':'..tostring(loop[k])..':'..#aebound..':'..tostring(ib))
--				if #aebound < 10 and i < 3 then
			elseif not U.inRC(b, {base}) then --, nil, true) then
					U.lo('?? is_OUT:'..i..':'..k..':'..tostring(loop[k])..':'..tostring(isout))
--			if not U.inRC(b, {base}) then
			elseif not U.inRC(b, {base}) then --, nil, true) then
					U.lo('?? is_OUT:'..i..':'..k..':'..tostring(loop[k])..':'..tostring(isout))
--			if not U.inRC(b, {base}) then
--			elseif not U.inRC(b, {base}, nil, true) then
--					U.lo('?? on_B:'..k..':'..tostring(loop[k]))
				if not isout then
				if not isout then
--                        lo('?? if_OUT:'..k..':'..tostring(loop[k]))
					local p,ind = crossBoundary(loop,k)
					local p,ind = crossBoundary(loop,k)
--						U.lo('?? if_P:'..tostring(p))
--                        lo('?? for_OUT:'..k..':'..tostring(p)..':'..ind..':'..#aebound)
--						U.lo('?? if_P:'..tostring(p))
--                        lo('?? for_OUT:'..k..':'..tostring(p)..':'..ind..':'..#aebound)
					if p then --and (U.mod(k,loop)-p):length()>0 then
						local ie = aebound[ind]
--								U.dump(aebound, '?? on_BOUND:'..k..':'..tostring(U.mod(k,loop))..':'..ind..':'..tostring(p))
						av[start+k].p = p
						local ie = aebound[ind]
--								U.dump(aebound, '?? on_BOUND:'..k..':'..tostring(U.mod(k,loop))..':'..ind..':'..tostring(p))
						av[start+k].p = p
						astick[#astick+1] = start+k
--                            U.dump(ae[aebound[ie]],'?? onB:'..k..':'..tostring(p)..'>'..ie..':'..ind..':'..(start+k)) --tostring(av[iv].p))
						-- update aebound
						astick[#astick+1] = start+k
--                            U.dump(ae[aebound[ie]],'?? onB:'..k..':'..tostring(p)..'>'..ie..':'..ind..':'..(start+k)) --tostring(av[iv].p))
						-- update aebound
--						end
--							U.lo('?? iFR:'..i..':'..k..':'..tostring(ifr))
--[[
			else
--					U.lo('?? tobound1:'..k..':'..tostring(isout))
				if isout and k+1 == isout then
--						U.dump(ae, '?? tobound2_AE:'..i..':'..k..':'..ind) --..':'..(start+k+1))
						U.dump(ae[aebound[ind]], '?? tobound2:'..i..':'..k..':'..tostring(p)) --..':'..ind..':'..ifr..':'..isout) --..(start+k+1))
					ito = aloopind[i][isout]
					local pc,s = U.line2seg(p,av[iv].p,av[e[1]].p,av[e[2]].p,0.00001)
--							U.dump(e,'?? for_dtep:'..k..':'..tostring(p)..'>'..tostring(pc)..':'..tostring(s)..':'..iv) --..':'..tostring((pc-p):dot(p-av[iv].p)))
--						if i == 12 then -- and k == 5 then
					local pc,s = U.line2seg(p,av[iv].p,av[e[1]].p,av[e[2]].p,0.00001)
--							U.dump(e,'?? for_dtep:'..k..':'..tostring(p)..'>'..tostring(pc)..':'..tostring(s)..':'..iv) --..':'..tostring((pc-p):dot(p-av[iv].p)))
--						if i == 12 then -- and k == 5 then
					local pc,s = U.line2seg(p,av[iv].p,av[e[1]].p,av[e[2]].p,0.00001)
--							U.dump(e,'?? for_dtep:'..k..':'..tostring(p)..'>'..tostring(pc)..':'..tostring(s)..':'..iv) --..':'..tostring((pc-p):dot(p-av[iv].p)))
--						if i == 12 then -- and k == 5 then
					local pc,s = U.line2seg(p,av[iv].p,av[e[1]].p,av[e[2]].p,0.00001)
--							U.dump(e,'?? for_dtep:'..k..':'..tostring(p)..'>'..tostring(pc)..':'..tostring(s)..':'..iv) --..':'..tostring((pc-p):dot(p-av[iv].p)))
--						if i == 12 then -- and k == 5 then
--						if i == 12 then -- and k == 5 then
--							U.dump(e,'?? for_12:'..k..':'..tostring(p)..'>'..tostring(pc)..':'..tostring(s)..':'..iv) --..':'..tostring((pc-p):dot(p-av[iv].p)))
--						end
--						if i == 12 then -- and k == 5 then
--							U.dump(e,'?? for_12:'..k..':'..tostring(p)..'>'..tostring(pc)..':'..tostring(s)..':'..iv) --..':'..tostring((pc-p):dot(p-av[iv].p)))
--						end
--						if i == 12 then -- and k == 5 then
--							U.dump(e,'?? for_12:'..k..':'..tostring(p)..'>'..tostring(pc)..':'..tostring(s)..':'..iv) --..':'..tostring((pc-p):dot(p-av[iv].p)))
--						end
--						if i == 12 then -- and k == 5 then
--							U.dump(e,'?? for_12:'..k..':'..tostring(p)..'>'..tostring(pc)..':'..tostring(s)..':'..iv) --..':'..tostring((pc-p):dot(p-av[iv].p)))
--						end
						end
--						  U.dump(e,'??******* hit: v:'..iv..'>'..i..':'..tostring(d))
--              lo('?? cross_S:'..tostring(s))
--						  U.dump(e,'??******* hit: v:'..iv..'>'..i..':'..tostring(d))
--              lo('?? cross_S:'..tostring(s))
					end
		if pmi then
--			U.dump(ae[emi],'?? for_MI:'..i..':'..tostring(pmi)..':'..smi)
			if smi == 0 then
--			if i==9 then -- and emi==5 then
--				U.dump(ae, '?? to_EDGE:'..tostring(smi)..':'..emi)
--			end
        local ang = U.vang(av[b].p-av[a].p,av[c].p-av[b].p,true)
--          if dbg then lo('?? for_angg:'..c..':'..d..'>>'..tostring(ang)..' 1:'..tostring(av[b].p-av[a].p)..' 2:'..tostring(av[c].p-av[b].p)) end
--          lo('?? for_ang:'..ang..':'..c..'<'..b..'<'..a..':'..U.vang(av[b].p-av[a].p,vec3(0,-1,0),true))
        local ang = U.vang(av[b].p-av[a].p,av[c].p-av[b].p,true)
--          if dbg then lo('?? for_angg:'..c..':'..d..'>>'..tostring(ang)..' 1:'..tostring(av[b].p-av[a].p)..' 2:'..tostring(av[c].p-av[b].p)) end
--          lo('?? for_ang:'..ang..':'..c..'<'..b..'<'..a..':'..U.vang(av[b].p-av[a].p,vec3(0,-1,0),true))
        local ang = U.vang(av[b].p-av[a].p,av[c].p-av[b].p,true)
--          if dbg then lo('?? for_angg:'..c..':'..d..'>>'..tostring(ang)..' 1:'..tostring(av[b].p-av[a].p)..' 2:'..tostring(av[c].p-av[b].p)) end
--          lo('?? for_ang:'..ang..':'..c..'<'..b..'<'..a..':'..U.vang(av[b].p-av[a].p,vec3(0,-1,0),true))
    end
--      lo('?? ama:'..ima..'<'..b..'<'..a..':'..ama..':'..tostring(b
			if U.index({9,12,13,16}, piv)[0] or U.index({9,12,13,16}, iv)[0] then
              U.lo('?? sn_got:'..piv..'>'..iv..'>'..tostring(civ)) --..tostring(civ)..'/'..istart)
			end
			if U.index({9,12,13,16}, piv)[0] or U.index({9,12,13,16}, iv)[0] then
              U.lo('?? sn_got:'..piv..'>'..iv..'>'..tostring(civ)) --..tostring(civ)..'/'..istart)
			end
        end
--            U.dump(path, '?? ae_POSTSTEP: n:'..n..':'..tostring(istart==path[#path])..':'..nia)
        if path[#path] == istart then
  local an = {-(base[#base]-base[1]):cross(base[2]-base[1]):normalized()}
--      U.dump(base,'??_____________ rcPave:'..tostring(an[1]))
  for i,p in pairs(apath) do
						av[start+k].p = loop[k]
						lo('?? is_out:'..i..':'..k..' irc:'..tostring(irc))
						edgeUp(start+k,irc)
			local p = U.line2seg(U.mod(k,loop),U.mod(k+1,loop),rc[j],U.mod(j+1,rc))
--                lo('?? onB:'..tostring(p)..':'..j..':'..tostring(U.line2seg(rc[j],U.mod(j+1,rc),loop[k],U.mod(k-1,loop))))
			if p and U.line2seg(rc[j],U.mod(j+1,rc),U.mod(k,loop),U.mod(k+1,loop)) then
			local p = U.line2seg(U.mod(k,loop),U.mod(k+1,loop),rc[j],U.mod(j+1,rc))
--                lo('?? onB:'..tostring(p)..':'..j..':'..tostring(U.line2seg(rc[j],U.mod(j+1,rc),loop[k],U.mod(k-1,loop))))
			if p and U.line2seg(rc[j],U.mod(j+1,rc),U.mod(k,loop),U.mod(k+1,loop)) then
			if p and U.line2seg(rc[j],U.mod(j+1,rc),U.mod(k,loop),U.mod(k+1,loop)) then
--                lo('?? crossed:'..j..':'..tostring(p))
				return p,j
			if not U.inRC(b, {rc}) then
--                lo('?? is_OUT:'..k..':'..tostring(b))
				if not isout then
			else
--                lo('?? if_out:'..k..':'..tostring(isout))
				if isout and k+1 == isout then
--                    lo('?? to_STICK:'..k..':'..isout)
--                    lo('?? next_CROSS:'..k..':'..tostring(onBoundary(loop, k))..':'..tostring(U.mod(k,loop))..':'..tostring(U.mod(k+1,loop))..':'..tostring(outlast))
					loop[k+1],irc = onBoundary(loop, k)
--                    lo('?? to_STICK:'..k..':'..isout)
--                    lo('?? next_CROSS:'..k..':'..tostring(onBoundary(loop, k))..':'..tostring(U.mod(k,loop))..':'..tostring(U.mod(k+1,loop))..':'..tostring(outlast))
					loop[k+1],irc = onBoundary(loop, k)
--                    lo('?? to_STICK:'..k..':'..isout)
--                    lo('?? next_CROSS:'..k..':'..tostring(onBoundary(loop, k))..':'..tostring(U.mod(k,loop))..':'..tostring(U.mod(k+1,loop))..':'..tostring(outlast))
					loop[k+1],irc = onBoundary(loop, k)
--                    lo('?? to_STICK:'..k..':'..isout)
--                    lo('?? next_CROSS:'..k..':'..tostring(onBoundary(loop, k))..':'..tostring(U.mod(k,loop))..':'..tostring(U.mod(k+1,loop))..':'..tostring(outlast))
					loop[k+1],irc = onBoundary(loop, k)
				if dbg then
					U.lo('>>************ forCross:'..tostring(v), true)
--                    U.dump(vinfo, '>>************ forCross:'..tostring(v)..':'..#v4e)
					U.lo('>>************ forCross:'..tostring(v), true)
--                    U.dump(vinfo, '>>************ forCross:'..tostring(v)..':'..#v4e)
				end
						if i == 2 then
--                            lo('?? if_CROSS:'..tostring(p)..':'..tostring(p+v)..':'..tostring(e[1])..':'..tostring(e[2]), true)
						end
						if i == 2 then
--                            lo('?? if_CROSS:'..tostring(p)..':'..tostring(p+v)..':'..tostring(e[1])..':'..tostring(e[2]), true)
						end
						if i == 2 then
--                            lo('?? if_CROSS:'..tostring(p)..':'..tostring(p+v)..':'..tostring(e[1])..':'..tostring(e[2]), true)
						end
						if i == 2 then
--                            lo('?? if_CROSS:'..tostring(p)..':'..tostring(p+v)..':'..tostring(e[1])..':'..tostring(e[2]), true)
						end
						end
--                        if dbg then U.dump(e4v[i], '?? for_E:'..i..':'..tostring(c)) end
--                        if dbg then lo('?? for_E:'..i..':'..e4v[i][1].ind..':'..e4v[i][2].ind..':'..tostring(c), true) end
--                        if dbg then U.dump(e4v[i], '?? for_E:'..i..':'..tostring(c)) end
--                        if dbg then lo('?? for_E:'..i..':'..e4v[i][1].ind..':'..e4v[i][2].ind..':'..tostring(c), true) end
					if dbg and c then
					if dbg and c then
--                        U.dump(e4v[i], '??+++ for_e:'..i..':'..tostring(c))
--                        U.dump(e, '??+++ for_e:'..i..':'..tostring(c))
--                        U.dump(e4v[i], '??+++ for_e:'..i..':'..tostring(c))
--                        U.dump(e, '??+++ for_e:'..i..':'..tostring(c))
					end
			end
			if dbg then U.lo('<<************ forCross:'..tostring(cmi)..' d:'..tostring(dmi)..' isend:'..tostring(isend), true) end
		end
			end
			if dbg then U.lo('<<************ forCross:'..tostring(cmi)..' d:'..tostring(dmi)..' isend:'..tostring(isend), true) end
		end
			end
			if dbg then U.lo('<<************ forCross:'..tostring(cmi)..' d:'..tostring(dmi)..' isend:'..tostring(isend), true) end
		end
		local p = v4e[k].p
--            lo('?? for_P:'..tostring(p))
		if isdupe then
				if istest then U.dump(e4v[imi], '??__________________ DUPE:'..tostring(cmi)..':'..tostring(imi)) end
			v4e[k].isdupe = true
		if isdupe then
				if istest then U.dump(e4v[imi], '??__________________ DUPE:'..tostring(cmi)..':'..tostring(imi)) end
			v4e[k].isdupe = true
		end
--            lo('?? post_CROSS:'..k..':'..tostring(cmi)..':'..tostring(isend))
--            if v4e[k].ij[1] == 2 and v4e[k].ij[2] ==1 then
		end
--            lo('?? post_CROSS:'..k..':'..tostring(cmi)..':'..tostring(isend))
--            if v4e[k].ij[1] == 2 and v4e[k].ij[2] ==1 then
--            if v4e[k].ij[1] == 2 and v4e[k].ij[2] ==1 then
--                U.lo('?? for_2:'..k..' cmi:'..tostring(cmi)..':'..tostring(isend))
--            end
--            if v4e[k].ij[1] == 2 and v4e[k].ij[2] ==1 then
--                U.lo('?? for_2:'..k..' cmi:'..tostring(cmi)..':'..tostring(isend))
--            end
			local d = (cmi-ae[imi][1]):length()/(ae[imi][2]-ae[imi][1]):length()
--                U.dump(e4v[imi], '?? v:'..k..' to:'..tostring(d))
			e4v[imi][#e4v[imi]+1] = {ind = k, d = d, done = 0}
			v4e[k][#v4e[k]+1] = imi
--                U.dump(v4e[k], '?? v___:'..k..' to:'..tostring(d)..':'..imi)
		elseif imi then
		elseif imi then
--            U.dump(ae[imi], '?? for_cross: k='..k..' ie:'..imi..':'..tostring(p))
			-- edges connecting loops
					if isend then
--                        U.dump(e4v[#e4v], '??********************* new_e4v:'..#v4e..':'..tostring(isend))
					end
		end
--            U.dump(ima, '<< stepFrom:'..tostring(ima[1].ind))
		if ima then
--            ima.done = true
			if istest then U.lo('<< stepFrom:'..tostring(ima[1].ind), true) end
		else
			for k,n in ipairs(list) do
--                        lo('?? if_n:'..k..':'..tostring(n.done == 0))
				if n.done == 0 then
--                            if ns < 10 then
--                                lo('?? nxt: k:'..k..' vert:'..n.ind..' start:'..rc[1]..':'..tostring(npre)..'>'..tostring(inxt))
--                            end
--                            if ns < 10 then
--                                lo('?? nxt: k:'..k..' vert:'..n.ind..' start:'..rc[1]..':'..tostring(npre)..'>'..tostring(inxt))
--                            end
						end
--                            U.lo('??+++++ next:'..tostring(inxt)..' ext:'..pext..'>'..tostring(ext)..':'..inext)
--                        rc[#rc+1] = inext
						end
--                            U.lo('??+++++ next:'..tostring(inxt)..' ext:'..pext..'>'..tostring(ext)..':'..inext)
--                        rc[#rc+1] = inext
			local ist = U.index(ast,st)[1]
--                lo('?? for_stamp:'..stamp({arc[k][1],arc[k][2],arc[k][3],arc[k][4]})..':'..tostring(ist), true)
			if not ist then ist = 0 end
--        U.dump(av, '?? for_AV:')
--        lo('?? for_start:'..tostring(av[3])..':'..tostring(rc[1])..':'..tostring(rc[3]))
	-- triangulate
--        U.dump(av, '?? for_AV:')
--        lo('?? for_start:'..tostring(av[3])..':'..tostring(rc[1])..':'..tostring(rc[3]))
	-- triangulate
--        U.dump(av, '?? for_AV:')
--        lo('?? for_start:'..tostring(av[3])..':'..tostring(rc[1])..':'..tostring(rc[3]))
	-- triangulate
	--        if not ist then ist = 0 end
	--            lo('?? for_rc:'..k..':'..tostring(ist)..':'..stamp({arc[k][1],arc[k][2],arc[k][3],arc[k][4]}), true)
	--[[
		if not m.faces or #m.faces == 0 then
			lo('!!_________ valid1:'..i..'/'..#am..':'..tostring(m.faces))
			return false
		if #afdel>0 then
			lo('?? ERR_valid_FACES:'..#afdel..'/'..#m.faces..':'..tostring(m.key))
			amdel[#amdel+1] = i
--        lo('>> meshUp:'..#data)
--    lo('>> meshUp:'..tostring(group))
	if nm == nil then nm = 'm' end
	local id = om:getID()
--		lo('?? meshUp_if_ID:'..cid..':'..tostring(id)..':'..tostring(otmp))
--	om:unregisterObject()
	local id = om:getID()
--		lo('?? meshUp_if_ID:'..cid..':'..tostring(id)..':'..tostring(otmp))
--	om:unregisterObject()
--				end
--					lo('?? for_DIST: i='..i..' c:'..tostring(c)..' istep:'..istep..':'..(s.p.x-psstep)..'> csstep:'..csstep..' psstep:'..psstep..':'..s.p.x)
		-- cross loop border with path
			if #list == 1 and (list[1]-c):dot(ap[j+1]-ap[j])>0 then
--							lo('?? is_CROSS:'..tostring(c)..':'..j..':'..(istep-1)..':'..tostring(list[1]))
--						c = list[1]
			if #list == 1 and (list[1]-c):dot(ap[j+1]-ap[j])>0 then
--							lo('?? is_CROSS:'..tostring(c)..':'..j..':'..(istep-1)..':'..tostring(list[1]))
--						c = list[1]
				for _,p in pairs(s.list) do
--								lo('?? in_LOOP:'.._..':'..tostring(p)..':'..j..':'..istep)
					--- find cross with segments
--									U.out.aset[3] = {set={ap[k],ap[k+1]}, c={1,0,0}, w=0.03}
--										lo('?? if_CROSS:'..tostring(ap[k])..':'..tostring(ap[k+1]))
--									U.out.aset[2] = {set={c+dir*p.x,c+dir*p.x+dirp}, c={1,0,0}, w=0.05}
--									U.out.aset[3] = {set={ap[k],ap[k+1]}, c={1,0,0}, w=0.03}
--										lo('?? if_CROSS:'..tostring(ap[k])..':'..tostring(ap[k+1]))
--									U.out.aset[2] = {set={c+dir*p.x,c+dir*p.x+dirp}, c={1,0,0}, w=0.05}
						if v then
--										lo('?? cross:'..k..':'..tostring(v)..':'..q)
							loop[#loop+1] = vec3(adist[k]+astep[k]*q, s.p.y+p.y)
	if not mbody then return end
--		lo('?? frameSpline:'..#mbody.normals..':'..tostring(aloop))
--			U.out.f:close()
--			if true then return end
--			U.dump(mbody.verts, '?? MB_VERTS:'..tostring(pmi))
	-- order verts
	for i,v in pairs(av) do
--			lo('?? lifting:'..i..' v.d:'..tonumber(v.d)..':'..csind..'/'..#adist..' ad[ci]:'..tonumber(adist[csind])..':'..N..':'..tostring(tonumber(v.d)>tonumber(adist[csind])))
		if adist[csind] and adist[csind-1] then
			end
--				lo('?? for_cind:'..csind..':'..tostring(adist[csind-1]))
			local pdist = adist[csind-1] or nil
		--				lo('?? for_v:'..i..':'..csind..' d:'..v.d..'/'..adist[csind]..':'..(v.d-adist[csind-1])..' ind:'..v.ind..' s:'..s) --..(adist[csind-1]-v.d))
		--				lo('?? ap:'..tostring(ap[csind-1])..':'..tostring(ap[csind]))
				local n = ap[csind-1]*(1-s) + ap[csind]*s
		--				lo('?? for_v:'..i..':'..csind..' d:'..v.d..'/'..adist[csind]..':'..(v.d-adist[csind-1])..' ind:'..v.ind..' s:'..s) --..(adist[csind-1]-v.d))
		--				lo('?? ap:'..tostring(ap[csind-1])..':'..tostring(ap[csind]))
				local n = ap[csind-1]*(1-s) + ap[csind]*s
				anorm[v.ind] = aenorm[csind-1]*(1-s) + aenorm[csind]*s --):normalized()
		--				lo('??_______ for_PRE:'..i..':'..tostring(n)..' s:'..s..':'..tostring(ap[csind-1])..' csi:'..(csind-1))
				local z = mbody.verts[v.ind].y
				anorm[v.ind] = aenorm[csind-1]*(1-s) + aenorm[csind]*s --):normalized()
		--				lo('??_______ for_PRE:'..i..':'..tostring(n)..' s:'..s..':'..tostring(ap[csind-1])..' csi:'..(csind-1))
				local z = mbody.verts[v.ind].y
			local norm = ((loop[2]-loop[1]):cross(loop[#loop]-loop[1])):normalized()
	--			lo('?? for_NORM:'..i..':'..tostring(norm))
			mbody.normals[i] = -norm
		end
--			U.dump(loop,'?? for_NORM:'.._..':'..tostring(norm))
	end
	for i=1,#aface,3 do
--			lo('?? fof:'..i..':'..tostring(aface[i])..':'..tostring(aface[i+1]))
		toStar(aface[i].v,aface[i+1].v)
	for i=1,#aface,3 do
--			lo('?? fof:'..i..':'..tostring(aface[i])..':'..tostring(aface[i+1]))
		toStar(aface[i].v,aface[i+1].v)
		if i>#aface-2 then return end
--			lo('?? for_FACE:'..i..':'..tostring(aface[i])..':'..tostring(aface[i+1])..':'..tostring(aface[i+2]))
		local vn = (av[aface[i+1].v]-av[aface[i].v]):cross(av[aface[i+2].v]-av[aface[i].v])
		if i>#aface-2 then return end
--			lo('?? for_FACE:'..i..':'..tostring(aface[i])..':'..tostring(aface[i+1])..':'..tostring(aface[i+2]))
		local vn = (av[aface[i+1].v]-av[aface[i].v]):cross(av[aface[i+2].v]-av[aface[i].v])
		if i>#aface-2 then return end
--			lo('?? for_FACE:'..i..':'..tostring(aface[i])..':'..tostring(aface[i+1])..':'..tostring(aface[i+2]))
		local vn = (av[aface[i+1].v]-av[aface[i].v]):cross(av[aface[i+2].v]-av[aface[i].v])
	for i=1,#aface,3 do
--			lo('?? fof:'..i..':'..tostring(aface[i])..':'..tostring(aface[i+1]))
		toStar(aface[i].v,aface[i+1].v)
	for i=1,#aface,3 do
--			lo('?? fof:'..i..':'..tostring(aface[i])..':'..tostring(aface[i+1]))
		toStar(aface[i].v,aface[i+1].v)
					f = s
--						lo('?? HIT:'..i..':'..tostring(s)..':'..tostring(ind))
					break
					f = s
--						lo('?? HIT:'..i..':'..tostring(s)..':'..tostring(ind))
					break
		end
--			lo('?? for_FACE:'..i..':'..tostring(f)) --..':'..tostring(hit)..':'..#abag)
		if not fbag[f] then fbag[f] = {} end
		end
--			lo('?? for_FACE:'..i..':'..tostring(f)) --..':'..tostring(hit)..':'..#abag)
		if not fbag[f] then fbag[f] = {} end
						f = acand[#acand]
--							lo('??____ for_F:'..f) --..' ang:'..tostring(ang))
						surf[#surf+1] = f
						f,ang = fnext(f)
							lo('?? for_NEXT:'..tostring(sf)..'>'..tostring(f)..'/'..tostring(ang))
						if not f then
						f,ang = fnext(f)
							lo('?? for_NEXT:'..tostring(sf)..'>'..tostring(f)..'/'..tostring(ang))
						if not f then
						f,ang = fnext(f)
							lo('?? for_NEXT:'..tostring(sf)..'>'..tostring(f)..'/'..tostring(ang))
						if not f then
		for _,f in pairs(b.af) do
--						lo('?? for_AB:'..k..'>'.._..':'..tostring(p)..':'..tostring(f.p)..':'..tostring(f.vn))
			d = math.abs((a.m.verts[p]-f.p):dot(f.vn))
		for _,f in pairs(b.af) do
--						lo('?? for_AB:'..k..'>'.._..':'..tostring(p)..':'..tostring(f.p)..':'..tostring(f.vn))
			d = math.abs((a.m.verts[p]-f.p):dot(f.vn))
		for _,f in pairs(b.af) do
--						lo('?? for_AB:'..k..'>'.._..':'..tostring(p)..':'..tostring(f.p)..':'..tostring(f.vn))
			d = math.abs((a.m.verts[p]-f.p):dot(f.vn))
--				if d == 0 then
--					lo('?? dmi0:'..tostring(f.vn)..':'..tostring(a.m.verts[p])..':'..tostring(f.p))
--				end
--				if d == 0 then
--					lo('?? dmi0:'..tostring(f.vn)..':'..tostring(a.m.verts[p])..':'..tostring(f.p))
--				end
--				if d == 0 then
--					lo('?? dmi0:'..tostring(f.vn)..':'..tostring(a.m.verts[p])..':'..tostring(f.p))
--				end
				if dbg then
					U.dump(fmi, '?? joint_HIT:'..dmi..':'..tostring(a.m.verts[imi]))
				end
				for _,f in pairs(b.af) do
--						lo('?? for_AB:'..tostring(p)..':'..tostring(f.p)..':'..tostring(f.vn))
					d = math.abs((m.verts[p]-f.p):dot(f.vn))
				for _,f in pairs(b.af) do
--						lo('?? for_AB:'..tostring(p)..':'..tostring(f.p)..':'..tostring(f.vn))
					d = math.abs((m.verts[p]-f.p):dot(f.vn))
				for _,f in pairs(b.af) do
--						lo('?? for_AB:'..tostring(p)..':'..tostring(f.p)..':'..tostring(f.vn))
					d = math.abs((m.verts[p]-f.p):dot(f.vn))
								if dbg and p == 20 then
									U.dump(fmi.av, '?? ang:'..t..':'..ang..':'..tostring(m.verts[p]))
									list[#list+1] = p -- m.verts[p]
							if dbg and p == 20 then
								U.dump(fmi.av, '?? ang:'..t..':'..ang..':'..tostring(m.verts[p]))
								list[#list+1] = p -- m.verts[p]
							if i==1 and j==2 then
--								lo('?? ang:'..t..':'..ang) --..':'..tostring(m.verts[p]))
								U.dump(fmi.av,'?? ang:'..t..':'..ang..':'..tostring(m.verts[p]))
--								lo('?? ang:'..t..':'..ang) --..':'..tostring(m.verts[p]))
								U.dump(fmi.av,'?? ang:'..t..':'..ang..':'..tostring(m.verts[p]))
							end
		local mat = daedata.dgeo[m.key].mat
--                dump(mat.c,'?? for_DS:'..i..':'..ds..':'..tostring(m.key)..':'..tostring(mat.c)) --..(#am - 1)..':'..(i-(#am - 1)/2-1)) --..':'..ds)
--            colorOn(mat.body,{mat.c[1],mat.c[2],mat.c[3],0.5+0.5*math.abs(val/10)})
		local mat = daedata.dgeo[m.key].mat
--                dump(mat.c,'?? for_DS:'..i..':'..ds..':'..tostring(m.key)..':'..tostring(mat.c)) --..(#am - 1)..':'..(i-(#am - 1)/2-1)) --..':'..ds)
--            colorOn(mat.body,{mat.c[1],mat.c[2],mat.c[3],0.5+0.5*math.abs(val/10)})
--	U.draw()
--		lo('?? to_SET:'..tostring(#M.out.aset))
	if M.out.agraph then
Mesh.LB = function(a)
	lo('?? LB:'..tostring(a))
end
--    buf[pos + 5] = v.z
	lo('?? toLineBuff31:'..tostring(u)..'::'..tostring(pos))
--    buf[pos + 5] = v.z
	lo('?? toLineBuff31:'..tostring(u)..'::'..tostring(pos))
--    buf[pos + 5] = v.z
	lo('?? toLineBuf1:'..tostring(#buf))
	roadID = road:getID()
	lo('?? createMesh_id:'..tostring(roadID))
	road:unregisterObject()
@/lua/vehicle/controller/tech/screens.lua
      screen.windowX, screen.windowY,
      tostring(screen.borderless))
    obj:queueGameEngineLua(queueString)
@/lua/ge/extensions/editor/dynamicDecals/history.lua
    local action = history.undoStack[k]
    im.PushID1(tostring(k))
    if im.Selectable1(tostring(k) .. ": " .. action.name, isSel) then undoStackSelectedIndex = k end
    im.PushID1(tostring(k))
    if im.Selectable1(tostring(k) .. ": " .. action.name, isSel) then undoStackSelectedIndex = k end
    if im.IsItemHovered() then
    local action = history.redoStack[k]
    im.PushID1(tostring(k) .. "redo")
    if im.Selectable1(tostring(k) .. ": " .. action.name, isSel) then redoStackSelectedIndex = k end
    im.PushID1(tostring(k) .. "redo")
    if im.Selectable1(tostring(k) .. ": " .. action.name, isSel) then redoStackSelectedIndex = k end
    if im.IsItemHovered() then
@/lua/vehicle/particlefilter.lua
        if r.compareFunc(p) then
          --log('D', "particlefilter.particleEmitted", "spawned particle type " .. tostring(p.particleType))
          obj:addParticleVelWidthTypeCount(p.id1, p.normal, p.nodeVel, r.veloMult, r.width, r.particleType, r.count)
@/lua/ge/extensions/editor/tech/roadArchitect/geometry.lua
        road.tunnels[i] = {
          name = 'tunnel_' .. tostring(i),
          s = sec.s, e = sec.e,
@/lua/ge/extensions/scenario/driftGoal.lua
    else
      result = {msg={txt = "extensions.scenario.drift.passGoal", context = {driftPoints = tostring(instance.value.driftPoints)}}}
    end
    else
      result = {failed={txt = "extensions.scenario.drift.failedGoal", context = {minDrift = tostring(instance.value.minDrift)}}}
    end
      if instance.value.minDrift and type(instance.value.minDrift)~="number" then
        log('E', 'In '..tostring(scenario.name), ' minDrift must contain number value  ')
        goto continue
      if instance.value.maxDrift and type(instance.value.maxDrift)~= "number" then
        log('E', 'In '..tostring(scenario.name), ' maxDrift must contain number value  ')
        goto continue
@/lua/ge/extensions/flowgraph/nodes/ui/imgui/imDialogue.lua
  im.Text(dumps(self.options))
  im.Text(tostring(self.id))
  for i, btn in ipairs(self.options) do
  if self.open then
    im.Begin((self.pinIn.title.value or "Title") .. '##' .. tostring(self.id), im.BoolPtr(true))
    im.PushTextWrapPos(im.GetCursorPosX() + (self.data.wrapSize or 500))
@/lua/vehicle/powertrain/multiShaft.lua
    device.outputPorts[i] = true
    device.outputTorqueNames[i] = "outputTorque" .. tostring(i)
    device.outputAVNames[i] = "outputAV" .. tostring(i)
    device.outputTorqueNames[i] = "outputTorque" .. tostring(i)
    device.outputAVNames[i] = "outputAV" .. tostring(i)
    device[device.outputTorqueNames[i]] = 0
@/lua/ge/extensions/campaign/dealer.lua
local function addToStock(itemType, valueObj)
  log('I', logTag, 'addToStock called... itemType '..tostring(itemType)..' '..type(valueObj))
  local state = M.state
local function removeFromStock(itemType, valueObj)
  log('I', logTag, 'removeFromStock called... itemType '..tostring(itemType)..' '..type(valueObj))
  -- dump(state.stock)
@/lua/ge/extensions/ui/vehicleSelector/tileGrouping.lua
      table.insert(decades, {
        groupName = tostring(decade) .. "s",
        groupOrder = 0
@/lua/ge/extensions/flowgraph/nodes/gameplay/dragRace/loadDragData.lua
  else
    self:__setNodeError('load', 'Failed to load drag data from: ' .. tostring(self.pinIn.filepath.value))
    self.pinOut.success.value = false
@/lua/vehicle/beamstate.lua
local function broadcastCouplerVisibility(visibleTags)
  BeamEngine:queueAllObjectLua("beamstate.setCouplerVisiblityExternal(" .. tostring(obj:getId()) .. "," .. serialize(visibleTags) .. ")")
end
local function sendExportCouplerData(obj2Id, obj2nodeId, data)
  obj:queueObjectLuaCommand(obj2Id, "beamstate.exportCouplerData(" .. tostring(obj2nodeId) .. ", " .. serialize(data) .. ")")
  M.updateRemoteElectrics = updateRemoteElectrics
    local data = {electrics = n.importElectrics, inputs = n.importInputs}
    --print("couplerAttached -> beamstate.exportCouplerData("..tostring(obj2nodeId)..", "..serialize(data)..")")
    -- obj:queueObjectLuaCommand(obj2id, "beamstate.exportCouplerData(" .. tostring(obj2nodeId) .. ", " .. serialize(data) .. ")")
    --print("couplerAttached -> beamstate.exportCouplerData("..tostring(obj2nodeId)..", "..serialize(data)..")")
    -- obj:queueObjectLuaCommand(obj2id, "beamstate.exportCouplerData(" .. tostring(obj2nodeId) .. ", " .. serialize(data) .. ")")
    -- M.updateRemoteElectrics = updateRemoteElectrics
      else
        --log('E', 'beamstate', 'unable to get part: ' .. tostring(partPath))
      end
      -- deformation: do not call c++ at all, its just used on the lua side anyways
      --print('deformed: ' .. tostring(cid) .. ' = ' .. tostring(beam[3]))
      onBeamDeformed(cid, beam[3])
      -- deformation: do not call c++ at all, its just used on the lua side anyways
      --print('deformed: ' .. tostring(cid) .. ' = ' .. tostring(beam[3]))
      onBeamDeformed(cid, beam[3])
@/lua/ge/extensions/telemetry/core.lua
  if file then
    file:write(tostring(eventBuffer))
    file:close()
@/lua/ge/extensions/gameplay/sites/zone.lua
        debugDrawer:drawTextAdvanced(((v.pos + self.vertices[v.next])/2),
          String(string.format("t=%0.1f  |  u=%s",v.t,tostring(v.u))),
          ColorF(1,1,1,1),true, false,
@/lua/common/libs/luasocket/socket/mime.lua
        if not f then 
            base.error("unknown key (" .. base.tostring(name) .. ")", 3)
        else return f(opt1, opt2) end
@/lua/ge/extensions/editor/logHelper.lua
  if type(t.errors) == 'number' and t.errors > 0 then
    im.TextColored(im.ImVec4(1.0, 0.0, 0.0, 1.0), tostring(t.errors) .. 'E ')
    --im.SameLine()
  if type(t.warnings) == 'number' and t.warnings > 0 then
    im.TextColored(im.ImVec4(1.0, 1.0, 0.0, 1.0), tostring(t.warnings) .. 'W')
  end
@/lua/ge/extensions/util/autoAnnotation.lua
    if guess == nil then
      log('W', 'autoAnnotation', 'Shape that has no matching guess, defaulting to OBSTACLES: ' .. tostring(shapeName))
      guess = 'OBSTACLES'
  local id = node:getID()
  local str = tostring(className) .. ': ' ..tostring(name) .. '(' .. tostring(id) .. ')'
  local id = node:getID()
  local str = tostring(className) .. ': ' ..tostring(name) .. '(' .. tostring(id) .. ')'
  local id = node:getID()
  local str = tostring(className) .. ': ' ..tostring(name) .. '(' .. tostring(id) .. ')'
    if guess == nil then
      log('W', 'autoAnnotation', 'GroundCover name has no matching guess, defaulting to NATURE: ' .. tostring(name))
      guess = 'NATURE'
@/lua/ge/extensions/editor/dynamicDecals/layerStack.lua
        if editor.getPreference("dynamicDecalsTool.general.debug") then
          im.TextUnformatted(tostring(k))
          layerElementDragDropTargetDebug({1,0,0,1})
      if editor.getPreference("dynamicDecalsTool.general.debug") then
        im.TextUnformatted(tostring(1))
        layerElementDragDropTargetDebug({0,1,0,1})
    for name, color in pairs(data) do
      if im.ColorEdit4("##layerIconColor_" .. tostring(name), editor.getTempFloatArray4_TableTable(color), im.flags(im.ColorEditFlags_NoInputs, im.ColorEditFlags_AlphaPreview)) then
        data[name] = editor.getTempFloatArray4_TableTable()
@/lua/vehicle/electricsCustomValueParser.lua
  customElectricsEnv.logValue = function(value, label)
    print(string.format("Custom Electric: %s = %s", label or "", tostring(value)))
    return value
@/lua/common/libs/lustach/src/lustache/context.lua
          if(type(value)) == "number" then
            value = tostring(value)
          end
@/lua/ge/map.lua
          if prefix1 ~= prefix2 then
            log('E', 'map', "segment format issue: not the same prefix: ".. tostring(nargs2[1]) .. " and " .. tostring(nargs2[2]) .. " > discarding nodes. Please fix")
          end
          if prefix1 ~= prefix2 then
            log('E', 'map', "segment format issue: not the same prefix: ".. tostring(nargs2[1]) .. " and " .. tostring(nargs2[2]) .. " > discarding nodes. Please fix")
          end
          for k = num1, num2 do
            tableInsert(nodeList, prefix1 .. tostring(k))
          end
          if mapNodes[wp2] == nil then
            log('E', 'map', "the manual waypoint (beamNGWaypoint) "..tostring(wp2).." referenced in "..mapFilename.." does not exist")
            break
    else
      log('E', 'map', "manual waypoint not found: "..tostring(wp1));
    end
      --if privateCount == 1 and otherCount == 1 then
        --log('W', 'map', "Node "..tostring(nid).." has single private link connected to single public link; it is recommended to make the private road join to an intersection.")
      --elseif otherCount == 1 and privateCount == count - 1 then
      --elseif otherCount == 1 and privateCount == count - 1 then
        --log('W', 'map', "Node "..tostring(nid).." has single public link connected to only private links; it is recommended to make this public road private as well.")
      --end
    if linksize == 1 then
      visLog("warn", n.pos, "dead end:"..tostring(nid))
    elseif linksize == 0 then
    elseif linksize == 0 then
      visLog("error", n.pos, "isolated node:"..tostring(nid))
    end
    local tpos = nextTrigger:getPosition()
    --print("player pos: " .. tostring(ppos))
    --print("trigger pos: " .. tostring(tpos))
    --print("player pos: " .. tostring(ppos))
    --print("trigger pos: " .. tostring(tpos))
    local l = 'ai.setTarget('..tostring(tpos)..')'
    --print("trigger pos: " .. tostring(tpos))
    local l = 'ai.setTarget('..tostring(tpos)..')'
    --print(l)
local function onAddWaypoint(wp)
  --print("waypoint added: " .. tostring(wp))
  if isEditorEnabled then
local function onRemoveWaypoint(wp)
  --print("waypoint removed: " .. tostring(wp))
  if isEditorEnabled then
local function onModifiedWaypoint(wp)
  --print("waypoint modified: " .. tostring(wp))
  if isEditorEnabled then
@/lua/ge/extensions/flowgraph/builder.lua
function C:Begin(nodeID)
  --print('------------------- ' .. tostring(nodeID))
  self.HasHeader  = false

  --print(' SetStage = ' .. tostring(oldStage) .. ' -> ' .. tostring(stage))

  --print(' SetStage = ' .. tostring(oldStage) .. ' -> ' .. tostring(stage))
@/gameplay/missionTypes/collection/customNodes/collectionMarkersNode.lua
  marker.scale = vec3(1, 1, 1)
  marker:registerObject(Sim.getUniqueName("Marker"..tostring(pos)))
  return marker:getId()
  light:setField('radius', 0, 3)
  light:registerObject(Sim.getUniqueName("Light"..tostring(pos)))
  return light:getId()
@/gameplay/tutorials/customNodes/getLocationsNode.lua
    if location then
      self.pinOut["idLocation"..tostring(i)].value = location.id

      self.pinOut["name"..tostring(i)].value = location.desc.name
      self.pinOut["type"..tostring(i)].value = location.desc.type
      self.pinOut["name"..tostring(i)].value = location.desc.name
      self.pinOut["type"..tostring(i)].value = location.desc.type
      self.pinOut["desc"..tostring(i)].value = location.desc.desc
      self.pinOut["type"..tostring(i)].value = location.desc.type
      self.pinOut["desc"..tostring(i)].value = location.desc.desc
      self.pinOut["pos"..tostring(i)].value = location.pos
      self.pinOut["desc"..tostring(i)].value = location.desc.desc
      self.pinOut["pos"..tostring(i)].value = location.pos
      self.pinOut["rot"..tostring(i)].value = location.rot
      self.pinOut["pos"..tostring(i)].value = location.pos
      self.pinOut["rot"..tostring(i)].value = location.rot
      if carData then
        self.pinOut["blackListed"..tostring(i)].value = checkBlacklisted(i, carData.locationsLeft)
      else
      else
        self.pinOut["blackListed"..tostring(i)].value = false
      end
@/lua/common/libs/copas/copas/semaphore.lua
  if timeout < 0 then
    error("expected timeout (2nd argument) to be a number greater than or equal to 0, got: " .. tostring(seconds), 2)
  end
  if max < 1 then
    error("expected max resources (1st argument) to be a number greater than 0, got: " .. tostring(max), 2)
  end
@/lua/vehicle/powertrain/shaft.lua

  device.outputTorqueName = "outputTorque" .. tostring(outputPortIndex)
  device.outputAVName = "outputAV" .. tostring(outputPortIndex)
  device.outputTorqueName = "outputTorque" .. tostring(outputPortIndex)
  device.outputAVName = "outputAV" .. tostring(outputPortIndex)
  device[device.outputTorqueName] = 0
@/lua/ge/extensions/util/renderComponentsAPI.lua
      else
        log("E", "", "unable to read json file: " .. tostring(filename))
      end
      else
        log('E', '', 'Unable to find shader object: ' .. tostring(settingByKey[name].shaderObject))
      end
@/lua/ge/extensions/core/camera.lua
    else
      log('W', '', 'Unable to find vdata for player '..tostring(player))
    end
    else
      log('W', '', 'Unable to find vdata for player '..tostring(player))
    end
@/lua/ge/extensions/util/groundModelDebug.lua
      --debugDrawer:drawLine(res.pos, res.pos + res.normal, ColorF(0,1,0,1))
      --print(" hit object: " .. tostring(res.object:getId() .. ' in ' .. res.distance .. ' m distance'))
      -- removes the object - fun minigame ;)

        im.Text(tostring(v))
        im.NextColumn()
        im.Text(tostring(k))
        im.NextColumn()
      -- display
      -- if im.TreeNode1("Static Collision data: " .. tostring(c.worlds[1].tris) .. " tris") then
        --   if ui_imgui.SmallButton("select") then
        --     TorqueScript.eval('EWorldEditor.clearSelection();EWorldEditor.selectObject(' .. tostring(body.objId) .. ');EWorldEditor.dropCameraToSelection();')
        --   end
@/lua/common/extensions/ui/imguiUtils.lua
    for k, item in pairs(items) do
      local lbl = item.label .. "###" .. label .. tostring(k)
      if not item.icon then
        if k ~= selectedItem[0] then
          local lbl = item.label .. "##" .. label .. '_' .. tostring(k)
          if not item.icon then
      else
        local lbl = item.label .. "##" .. label .. tostring(k)
        if not item.icon then
      if type(v) ~= 'table' then
        imgui.TextUnformatted(tostring(k) .. ' :')
        imgui.SameLine()
        imgui.SameLine()
        imgui.TextUnformatted(tostring(v))
        -- imgui.Separator()
      else
        if imgui.TreeNode1(tostring(k)) then
          M.displayKeyValues(v)
  -- key value table for simplicity
  imgui.Columns(2, tostring(k))
  --imgui.SetColumnOffset(-1, 40)
    local display = true
    local newPath = fullpath .. '/' .. tostring(k)
    if display then
      imgui.Text(tostring(k))
      imgui.NextColumn()
    local display = true
    local newPath = fullpath .. '/' .. tostring(k)
    if display then
      if imgui.TreeNode2(newPath, tostring(k)) then
        M.addRecursiveTreeTable(val, newPath, noColumns, highlightCallback, itemCallback)
  while param ~= nil do
    imgui.Text(tostring(param))
    param = debug.getlocal( func, index )
        if level > 2 and tsize > 3 then
          if imgui.CollapsingHeader1(tostring(tsize)..' items##' .. fullpath) then
            renderSubTree(data, fullpath, highlightCallback, itemCallback)
    end
    imgui.Text(tostring(data))
    imgui.PopStyleColor()
    imgui.PushStyleColor2(imgui.Col_Text, imgui.ImVec4(0.7, 0.7, 1, 1))
    imgui.Text(tostring(data))
    imgui.PopStyleColor()
      imgui.PushStyleColor2(imgui.Col_Text, imgui.ImVec4(1, 0.7, 1, 1))
      imgui.Text(tostring(data))
      imgui.PopStyleColor()
      imgui.PushStyleColor2(imgui.Col_Text, imgui.ImVec4(0.7, 0.8, 0.5, 1))
      imgui.Text('class instance: ' .. tostring(ctype))
      imgui.PopStyleColor()
  else
    imgui.Text(tostring(data))
  end
    --  local f = ffi.cast("ImFont*", imgui.GetIO().Fonts.Fonts.Data) -- Data is an ImVector, so do some pointer math
    --  print('font 1: ' .. tostring(f))
    --  f = f + ffi.sizeof('ImFont') -- second font
    --  f = f + ffi.sizeof('ImFont') -- second font
    --  print('font 2: ' .. tostring(f))
    --  M._monospaceFontReference = f
    --imgui.PushFont(M._monospaceFontReference)
    local formatString = "%0." .. tostring(self.precision) .. "f"
    imgui.Text(formatString, sampledVal)
@/lua/ge/extensions/gameplay/rally/notebook/structured/textCompositor.lua
  local roundedDist, unit = self:roundDistance(dist)
  local distStr = tostring(roundedDist)
@/lua/common/luaBinding.lua
  local mt = getmetatable(t)
  -- log('E', '', '  __index invoked on ' .. tostring(mt.___type))
  local res = rawget(mt, k)
  if getFunc ~= nil then
    -- log('E', '', '   getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
    return getFunc(t)
  if getFunc ~= nil then
    -- log('E', '', '   getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
    return getFunc(t)
      if type(getFunc) == 'function' then
        -- log('E', '', '   getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
        rawset(origgetters, k, getFunc)
      if type(getFunc) == 'function' then
        -- log('E', '', '   getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
        rawset(origgetters, k, getFunc)
  local mt = getmetatable(t)
  -- log('E', '', '  __index invoked on ' .. tostring(mt.___type))
  local res = rawget(mt, k)
  if getFunc ~= nil then
    -- log('E', '', '   getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
    if type(getFunc) == 'function' then
  if getFunc ~= nil then
    -- log('E', '', '   getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
    if type(getFunc) == 'function' then
      if type(getFunc) == 'function' then
        -- log('E', '', '   getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
        rawset(origgetters, k, getFunc)
      if type(getFunc) == 'function' then
        -- log('E', '', '   getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
        rawset(origgetters, k, getFunc)
  local mt = getmetatable(t)
  --log('E', '', '__newindex invoked on ' .. tostring(mt.___type))
  local origsetters = rawget(mt, 2) -- 2 = setters
@/lua/ge/extensions/ui/gameplaySelector/tileSorting.lua
  if not sortMode or type(sortMode) ~= 'string' then
    log("W", "tileSorting", "Invalid sort mode provided: " .. tostring(sortMode))
    return sortFunctions[DEFAULT_SORT_MODE]
@/lua/ge/extensions/core/modmanager.lua
  local originArchivePath = FS:getOriginArchivePathRelative(vfsPath)
  --log('I', '', 'getModFromPath(' .. tostring(vfsPath) .. ') -> ' .. tostring(originArchivePath))
  if not originArchivePath then return nil end
  local originArchivePath = FS:getOriginArchivePathRelative(vfsPath)
  --log('I', '', 'getModFromPath(' .. tostring(vfsPath) .. ') -> ' .. tostring(originArchivePath))
  if not originArchivePath then return nil end

  log('I', 'checkMod', "Mods "..modname.." valid= "..tostring(mods[modname].valid) .. " conflict="..#(mods[modname].conflict or {}) )
  return mods[modname].valid and #mods[modname].conflict == 0
  if mods[modname] and mods[modname].fullpath == filename then
    --log('D', 'updateZIPEntry', "mod already known: " .. tostring(filename))
  elseif mods[modname] and mods[modname].fullpath ~= filename then --fix for FS changes (mandatory root slash), could also fix reactivation when you mode around
      d.hash = string.lower(hash)
      --log('D', 'updateZIPEntry', " * " .. tostring(filename) .. " = " .. tostring(hash))
    end
      d.hash = string.lower(hash)
      --log('D', 'updateZIPEntry', " * " .. tostring(filename) .. " = " .. tostring(hash))
    end
    --filesInZIP = zip:getFileList()
    --log('D', 'updateZIPEntry', "  entries: " .. tostring( #filesInZIP ) )
    --d.files = {}
    v2 = string.lower(v2)
    local modID = string.match(tostring(v2), '^/?mod_info/([0-9a-zA-Z]*)/info%.json')
    if modID then
      if jsonContent then
        mods[modname].modData = jsonDecode(jsonContent, tostring(filename) .. ' : ' .. tostring(v2))
        -- fix the relative paths to be absolute paths for the UI
      if jsonContent then
        mods[modname].modData = jsonDecode(jsonContent, tostring(filename) .. ' : ' .. tostring(v2))
        -- fix the relative paths to be absolute paths for the UI
          v2 = string.lower(v2)
          local modID = string.match(tostring(v2), '^/?mod_info/([0-9a-zA-Z]*)/info%.json')
          if modID then
            if jsonContent then
              local modInfo = jsonDecode(jsonContent, tostring(filename) .. ' : ' .. tostring(v2))
              if not modInfo then
            if jsonContent then
              local modInfo = jsonDecode(jsonContent, tostring(filename) .. ' : ' .. tostring(v2))
              if not modInfo then
              end
              -- log('D', 'checkDuplicatedMods', dumps(modInfo.filename).."  "..modID.."  "..dumps(modInfo.last_update).."  res="..tostring(modInfo.resource_date).."  rel="..tostring(modInfo.release_date).."")
              if idModList[modID] ~= nil then
              end
              -- log('D', 'checkDuplicatedMods', dumps(modInfo.filename).."  "..modID.."  "..dumps(modInfo.last_update).."  res="..tostring(modInfo.resource_date).."  rel="..tostring(modInfo.release_date).."")
              if idModList[modID] ~= nil then
                  log('D', 'checkDuplicatedMods', "modInfo = ".. dumps(mi) )
                  log('D', 'checkDuplicatedMods', "modID = "..tostring(mi.modID or mi.tagid or filepath).." => "..tostring(mi.lastUpdate) )
                  log('D', 'checkDuplicatedMods', "modID = "..tostring(modID).." => "..tostring(idModList[modID].lastUpdate) )
                  log('D', 'checkDuplicatedMods', "modInfo = ".. dumps(mi) )
                  log('D', 'checkDuplicatedMods', "modID = "..tostring(mi.modID or mi.tagid or filepath).." => "..tostring(mi.lastUpdate) )
                  log('D', 'checkDuplicatedMods', "modID = "..tostring(modID).." => "..tostring(idModList[modID].lastUpdate) )
                  log('D', 'checkDuplicatedMods', "modID = "..tostring(mi.modID or mi.tagid or filepath).." => "..tostring(mi.lastUpdate) )
                  log('D', 'checkDuplicatedMods', "modID = "..tostring(modID).." => "..tostring(idModList[modID].lastUpdate) )
                  break
                  log('D', 'checkDuplicatedMods', "modID = "..tostring(mi.modID or mi.tagid or filepath).." => "..tostring(mi.lastUpdate) )
                  log('D', 'checkDuplicatedMods', "modID = "..tostring(modID).." => "..tostring(idModList[modID].lastUpdate) )
                  break
                if idModList[modID].lastUpdate >= (modInfo.last_update or modInfo.release_date) then
                  log('D', 'checkDuplicatedMods', "caseid1 "..modname.."("..filepath.." | "..tostring(modInfo.last_update)..") is older than "..idModList[modID].modname.. "("..idModList[modID].fp.." | "..tostring(idModList[modID].lastUpdate)..")")
                  oldFilepath = filepath
                if idModList[modID].lastUpdate >= (modInfo.last_update or modInfo.release_date) then
                  log('D', 'checkDuplicatedMods', "caseid1 "..modname.."("..filepath.." | "..tostring(modInfo.last_update)..") is older than "..idModList[modID].modname.. "("..idModList[modID].fp.." | "..tostring(idModList[modID].lastUpdate)..")")
                  oldFilepath = filepath
                else
                  log('D', 'checkDuplicatedMods', "caseid2 "..idModList[modID].modname.."("..idModList[modID].fp.." | "..tostring(idModList[modID].lastUpdate)..") is older than "..modname.."("..filepath.." | "..tostring(modInfo.last_update)..")")
                  oldFilepath = idModList[modID].fp
                else
                  log('D', 'checkDuplicatedMods', "caseid2 "..idModList[modID].modname.."("..idModList[modID].fp.." | "..tostring(idModList[modID].lastUpdate)..") is older than "..modname.."("..filepath.." | "..tostring(modInfo.last_update)..")")
                  oldFilepath = idModList[modID].fp
    M.deleteMod(v.name)
    if FS:fileExists(v.path) then log('D', 'checkDuplicatedMods', "delete '"..tostring(v.path).."' = "..dumps(FS:removeFile(v.path)) ) end
    if FS:fileExists(v.path) then
    if FS:fileExists(v.path) then
      log('E', 'checkDuplicatedMods', "failed to delete "..tostring(v.path))
      local errMsgID = "Duplicate mod id="..v.name.."\n Delete this old file ["..v.path.."]"
    if updatedFromVersion then
      log('I', 'initDB', "Version update found. Coming from version '" .. tostring(updatedFromVersion) .. "'")
      local modData = jsonReadFile(persistencyfile)
      if mod and not isSafeMode() and mod.active ~= false then
        log('D', 'initDB', 'mountEntry -- ' .. tostring(filename) .. ': ' .. (mod.modID or '') .. ' : ' .. (mod.modname or ''))
        addMountEntryToList(mountList, filename, mod.mountPoint)
      mods[v.modname] = nil
      log('W', 'initDB', 'mod vanished: ' .. tostring(v.fullpath))
    end
  end
  log("D","initDB", "Notification : took ".. tostring(tim:stopAndReset()) .. "ms to reorganise ".. tostring(#newMountedFiles) .. " files")
  _G.onFileChanged(newMountedFiles) --main.lua
  end
  log("D","initDB", "Notification : took ".. tostring(tim:stopAndReset()) .. "ms to reorganise ".. tostring(#newMountedFiles) .. " files")
  _G.onFileChanged(newMountedFiles) --main.lua
  _G.onFileChanged(newMountedFiles) --main.lua
  log("D","initDB", "Notification : took ".. tostring(tim:stopAndReset()) .. "ms to callback")
    --local hash = hashFile(v)
    print(" * " .. tostring(v) .. " = " .. tostring(hash))
    --local hash = hashFile(v)
    print(" * " .. tostring(v) .. " = " .. tostring(hash))
    local filesInZIP = zip:getFileList()
    print("  entries: " .. tostring( #filesInZIP ) )
    for k2,v2 in pairs(filesInZIP) do
    print( "  Testing mounting of " .. v)
    print( "     checking isMountedZIP ... RESULT " .. tostring( FS:isMounted(v) ))
    print( "     checking mountZIP ... RESULT " .. tostring( FS:mount(v) ))
    print( "     checking isMountedZIP ... RESULT " .. tostring( FS:isMounted(v) ))
    print( "     checking mountZIP ... RESULT " .. tostring( FS:mount(v) ))
    print( "     checking isMountedZIP ... RESULT " .. tostring( FS:isMounted(v) ))
    print( "     checking mountZIP ... RESULT " .. tostring( FS:mount(v) ))
    print( "     checking isMountedZIP ... RESULT " .. tostring( FS:isMounted(v) ))
    print( "     checking unmountZIP ... RESULT " .. tostring( FS:unmount(v) ))
    print( "     checking isMountedZIP ... RESULT " .. tostring( FS:isMounted(v) ))
    print( "     checking unmountZIP ... RESULT " .. tostring( FS:unmount(v) ))
    print( "     checking isMountedZIP ... RESULT " .. tostring( FS:isMounted(v) ))
    print( "     checking unmountZIP ... RESULT " .. tostring( FS:unmount(v) ))
    print( "     checking isMountedZIP ... RESULT " .. tostring( FS:isMounted(v) ))
  if not mods[modname] then
    log('E', '_getModContentFileList', 'mod not existing ' .. tostring(modname))
    return {}
  if not mods[modname] then
    log('E', '_getModContentFileList', 'mod not existing ' .. tostring(modname))
    return nil
  if not mods[modname] then
    log('I', 'deactivateMod', 'mod not existing ' .. tostring(modname))
    return
  else
    log('I', 'deactivateModId', 'mod not existing ' .. tostring(modID))
  end
  if not mods[modname] then
     log('I', 'activateMod', 'mod not existing ' .. tostring(modname))
    return
  else
    log('I', 'activateModId', 'mod not existing ' .. tostring(modID))
  end
  if not mods[modname] then
    log('I', 'deleteMod', 'mod not existing ' .. tostring(modname))
    return
  if not mods[modname] then
    guihooks.trigger('modmanagerError', 'Error extracting file:  not existing:' .. tostring(modname))
    return

  log('D', 'unpackMod', 'Unpacking : ' .. tostring(filename))
  Engine.Platform.taskbarSetProgress(0.0)
  for i,v in ipairs(files) do
    --print('extractFile: ' .. tostring(v) .. ' -> ' .. tostring(targetPath) .. v)
    Engine.Platform.taskbarSetProgress(i / #files)
  for i,v in ipairs(files) do
    --print('extractFile: ' .. tostring(v) .. ' -> ' .. tostring(targetPath) .. v)
    Engine.Platform.taskbarSetProgress(i / #files)
    Engine.Platform.taskbarSetProgress(i / #files)
    log('D', 'unpackMod', 'zip-extractfile: ' .. tostring(v) .. ' > ' .. tostring(targetPath .. v))
    if not zip:extractFile(v, targetPath .. v) then
    Engine.Platform.taskbarSetProgress(i / #files)
    log('D', 'unpackMod', 'zip-extractfile: ' .. tostring(v) .. ' > ' .. tostring(targetPath .. v))
    if not zip:extractFile(v, targetPath .. v) then
      extractionRes = false
      guihooks.trigger('modmanagerError', 'Error extracting file: ' .. tostring(v))
      log('E', 'unpackMod', 'error extracting file: ' .. tostring(v))
      guihooks.trigger('modmanagerError', 'Error extracting file: ' .. tostring(v))
      log('E', 'unpackMod', 'error extracting file: ' .. tostring(v))
      Engine.Platform.taskbarSetProgressState(4)
    mods[modname] = zipOldCopy
    guihooks.trigger('modmanagerError', 'Error extracting file: ' .. tostring(v))
    Engine.Platform.taskbarSetProgressState(0)
local function packMod(dirPath)
  log('D', 'packMod', 'Packing : ' .. tostring(dirPath))
  if not FS:directoryExists(dirPath) then
  if not mods[modname] then
    guihooks.trigger('modmanagerError', 'Unable to pack mod: not existing: ' .. tostring(dirPath))
    return false
  if not mods[modname].unpackedPath then
    guihooks.trigger('modmanagerError', 'Unable to pack mod: not unpacked: ' .. tostring(filename))
    log('E', 'packMod', 'unable to pack mod: not unpacked: ' .. tostring(filename))
    guihooks.trigger('modmanagerError', 'Unable to pack mod: not unpacked: ' .. tostring(filename))
    log('E', 'packMod', 'unable to pack mod: not unpacked: ' .. tostring(filename))
    return false
    end
    log('D', 'packMod', 'zip-addfile: ' .. tostring(v) .. ' > ' .. tostring(zipPath))
    zip:addFile(v, zipPath)
    end
    log('D', 'packMod', 'zip-addfile: ' .. tostring(v) .. ' > ' .. tostring(zipPath))
    zip:addFile(v, zipPath)
  if ext == 'zip' and FS:fileExists(filename) and (type == 'added' or type == 'modified') then
    log('D', '', tostring(filename) .. ' : ' .. tostring(type) .. ' > ' .. tostring(ext))
    local mod, files = updateZIPEntry(filename)
  if ext == 'zip' and FS:fileExists(filename) and (type == 'added' or type == 'modified') then
    log('D', '', tostring(filename) .. ' : ' .. tostring(type) .. ' > ' .. tostring(ext))
    local mod, files = updateZIPEntry(filename)
  if ext == 'zip' and FS:fileExists(filename) and (type == 'added' or type == 'modified') then
    log('D', '', tostring(filename) .. ' : ' .. tostring(type) .. ' > ' .. tostring(ext))
    local mod, files = updateZIPEntry(filename)
    if mod and mod.active ~= false then
      log('D', '', 'activateMod -- ' .. tostring(filename))
      activateMod(mod.modname)
      if v.fullpath:match("/mods/unpacked") == nil then --no check for unpacked
        log('I', 'checkUpdate', 'old mod ' .. tostring(k))
        --[[local wasMounted = false
        if not zip:openArchiveName(v.fullpath, "r") then
          log('E', 'checkUpdate', 'error opening zip file for reading: ' .. tostring(v.fullpath))
          goto continue
        local filesInZIP = zip:getFileList()
        log('D', 'checkUpdate', "  entries: " .. tostring( #filesInZIP ) )
        table.insert(data, {name = k, hash = {} } )
          if hash == '' then
            log('E', 'checkUpdate', 'unable to hash file in zip: ' .. tostring(v.fullpath) .. ' / ' .. tostring(v))
          else
          if hash == '' then
            log('E', 'checkUpdate', 'unable to hash file in zip: ' .. tostring(v.fullpath) .. ' / ' .. tostring(v))
          else
        log('E', 'installMod.downloadFinishedCallback', 'Server Error')
        log('E', 'installMod.downloadFinishedCallback', 'url = '..tostring(request.uri))
        log('E', 'installMod.downloadFinishedCallback', 'responseBuf = '..tostring(request.responseBuffer))
        log('E', 'installMod.downloadFinishedCallback', 'url = '..tostring(request.uri))
        log('E', 'installMod.downloadFinishedCallback', 'responseBuf = '..tostring(request.responseBuffer))
        return
              deactivateModId(v.id)
              guihooks.trigger('modmanagerError', 'You have an outdated version of [ '..tostring(getModNameFromID(v.id))..' ]. This mod has been deactivated`')
            elseif v['action'] == "update" or v['action'] == "missing" then
              v.reason = v.action
              log('I', 'checkUpdate', tostring(v['action'])..' -- ' .. tostring(v.id) .. "  to " .. tostring(v.ver))
              extensions.core_repository.addUpdateQueue(v)
              v.reason = v.action
              log('I', 'checkUpdate', tostring(v['action'])..' -- ' .. tostring(v.id) .. "  to " .. tostring(v.ver))
              extensions.core_repository.addUpdateQueue(v)
              v.reason = v.action
              log('I', 'checkUpdate', tostring(v['action'])..' -- ' .. tostring(v.id) .. "  to " .. tostring(v.ver))
              extensions.core_repository.addUpdateQueue(v)
            else
              log('I', 'checkUpdate', 'unknown action for mod ' .. tostring(v.id))
            end
          end
          guihooks.trigger('checkUpdateCheckedMod', "SYNC "..tostring(core_modmanager.getModNameFromID(v.id) or v.filename:gsub(".zip","")) )
          job.yield()
      guihooks.trigger('modmanagerError', "updateZipMod: Failed to delete old ZIP")
      log("E","updateZipMod","Failed to delete old ZIP "..tostring(oldFileName))
      return
    guihooks.trigger('modmanagerError', "updateZipMod: Failed to rename ZIP")
    log("E","updateZipMod","Failed to rename ZIP ''"..tostring(oldFileNamex).."' > '"..newFileName.."'")
    return
@/lua/ge/extensions/flowgraph/nodes/scene/raceLineParking.lua
function C:work(args)
  local name = "node_trigger_" .. tostring(os.time()) .. "_" .. self.id
  if self.pinIn.clear.value then
      table.insert(wheels,{wheelNodePos = vehicle:getPosition() + nodePos, distance = -nodePos:dot(forward)})
      --debugDrawer:drawTextAdvanced(vehicle:getPosition() + nodePos, String(tostring(-nodePos:dot(forward))),  ColorF(1,1,1,1), true, false, ColorI(0,0,0,192))
    end
@/lua/ge/extensions/core/inventory.lua
local function addItem(itemType, valueObj)
  log('I', logTag, 'addItem called... itemType '..tostring(itemType)..' '..type(valueObj))
local function removeItem(itemType, valueObj)
  log('I', logTag, 'removeItem called... itemType '..tostring(itemType)..' '..type(valueObj))
local function processTable(operation, key, entry)
  -- log('I', logTag, 'processTable called...   operation: '..tostring(operation)..'  key: '..key)
  -- dump(entry)
  ]]
  log('I', logTag, 'processOnEvent called...   earnedMedal: '..tostring(earnedMedal))
@/lua/ge/extensions/campaign/campaigns.lua
    if not processedScenario then
      log('E', logTag, 'Campaign is invalid - Cannot find campaign scenario '..tostring(scenarioPath))
      return

  log('D', logTag, 'scenarioStarted called: scenario state '..tostring(scenario.state))
  if scenario.state and scenario.state == 'pre-start' then

  -- log('D', logTag, 'achievementRequirementMet returned '..tostring(result))
  return result
      else
        -- log('D', logTag, 'Rquirements not met: '..tostring(v.key))
      end
    else
      log('E', logTag, 'Failed to unlock achievement: '..tostring(v.key))
    end
local function rewardSelectionCallback(itemIndex)
  log('I', logTag, 'rewardSelectionCallback call...'..tostring(itemIndex))
  local vehReward = campaign.state.scenarioRewards.choices.vehicles[itemIndex]

  -- log('I', logTag, 'subsectionKey = '..tostring(subsectionKey) ..' entryTarget: '..tostring(entryTarget))

  -- log('I', logTag, 'subsectionKey = '..tostring(subsectionKey) ..' entryTarget: '..tostring(entryTarget))
local function startCampaign(newCampaign)
  log('I', logTag, 'startCampaign called...'..tostring(newCampaign.meta.startingLocation))
@/lua/ge/extensions/gameplay/statistic.lua
  if career then
    callbacksCareer[name][tostring(trigger)..tostring(callbackFunction)] = entry
    log("I","",string.format("Registered callback for %s at %0.2f", name, trigger))
  if career then
    callbacksCareer[name][tostring(trigger)..tostring(callbackFunction)] = entry
    log("I","",string.format("Registered callback for %s at %0.2f", name, trigger))
  else
    callbacks[name][tostring(trigger)..tostring(callbackFunction)] = entry
  end
  else
    callbacks[name][tostring(trigger)..tostring(callbackFunction)] = entry
  end
@/lua/ge/extensions/tech/techCore.lua
  if name == nil then
    name = 'procObj' .. tostring(objectCount)
    objectCount = objectCount + 1
    local runningIP, runningPort = serverSocket:getsockname()
    log('E', logTag, 'Server already running at ' .. runningIP .. '/' .. tostring(runningPort) .. '.')
    return
  serverSocket:close()
  log('I', logTag, 'Stopped listening on ' .. ip .. '/' .. tostring(port) .. ' (disconnected ' .. tostring(clientCount) .. ' clients) .')
  serverSocket:close()
  log('I', logTag, 'Stopped listening on ' .. ip .. '/' .. tostring(port) .. ' (disconnected ' .. tostring(clientCount) .. ' clients) .')
        local ip, clientPort = newClients[i]:getpeername()
        log('I', logTag, 'Accepted new client: ' .. tostring(ip) .. '/' .. tostring(clientPort))
      end
        local ip, clientPort = newClients[i]:getpeername()
        log('I', logTag, 'Accepted new client: ' .. tostring(ip) .. '/' .. tostring(clientPort))
      end
M.onVehicleConnectionReady = function(vehicleID, port)
  log('I', logTag, 'New vehicle connection: ' .. tostring(vehicleID) .. ', ' .. tostring(port))
  if isBlocking('vehicleConnection') then
M.onVehicleConnectionReady = function(vehicleID, port)
  log('I', logTag, 'New vehicle connection: ' .. tostring(vehicleID) .. ', ' .. tostring(port))
  if isBlocking('vehicleConnection') then
    if name == '' then
      name = tostring(vehicleID)
    end
      local obj = scenetree.findObject(spawnPending)
      log('I', logTag, 'Vehicle spawned: ' .. tostring(vID))
      if obj ~= nil and obj:getID() == vID then
    log('E', logTag, string.format([[Mismatching BeamNGpy protocol versions. Please ensure both BeamNG.tech and BeamNGpy are using the desired versions. BeamNGpy's is: %s, BeamNG.tech's is: %s]],
      tostring(request.protocolVersion), tostring(tcom.protocolVersion)))
  end
    log('E', logTag, string.format([[Mismatching BeamNGpy protocol versions. Please ensure both BeamNG.tech and BeamNGpy are using the desired versions. BeamNGpy's is: %s, BeamNG.tech's is: %s]],
      tostring(request.protocolVersion), tostring(tcom.protocolVersion)))
  end
  if sc.levelName then
    local infoPath = '/levels/' .. tostring(sc.levelName) .. '/info.json'
    if not FS:fileExists(infoPath) then
    if not FS:fileExists(infoPath) then
      local msg = 'Level not found: "' .. tostring(sc.levelName) .. '"'
      log('E', logTag, msg)
  local skipServer = server == nil
  command = string.format('tech_techCore.startConnection(\'%s\', %s)', tcomParams.ip, tostring(skipServer))
  veh:queueLuaCommand(command)
  if not core_vehicles.getModel(model).model then
    request:sendBNGError('Model not found: ' .. tostring(model))
    return false
    if veh == nil then
      request:sendBNGValueError('Vehicle not present for traffic: ' .. tostring(participant))
      return
    else
      request:sendResponse({type ='ExecutedLuaChunkGE', resp = tostring(err)})
    end
    if info['name'] == nil then
      info['name'] = tostring(id)
    end
  else
    request:sendBNGValueError('Unknown object ID: ' .. tostring(id))
  end
  if not veh then
    request:sendBNGValueError('Vehicle not found: "' .. tostring(request['vid']) .. '"')
    return false
@/lua/ge/extensions/editor/cosimulationSignalEditor.lua
    for i = 1, numWheels do
      local wId = tostring(wheelData[i])
      signals[#signals + 1] = {
        local pos, rot = veh:getPosition(), quatFromDir(veh:getDirectionVector(), veh:getDirectionVectorUp())
        csv:add('vehicle', nil, 'posX', tostring(pos.x), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'posY', tostring(pos.y), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'posX', tostring(pos.x), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'posY', tostring(pos.y), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'posZ', tostring(pos.z), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'posY', tostring(pos.y), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'posZ', tostring(pos.z), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotX', tostring(rot.x), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'posZ', tostring(pos.z), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotX', tostring(rot.x), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotY', tostring(rot.y), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotX', tostring(rot.x), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotY', tostring(rot.y), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotZ', tostring(rot.z), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotY', tostring(rot.y), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotZ', tostring(rot.z), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotW', tostring(rot.w), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotZ', tostring(rot.z), "number", nil, nil, nil)
        csv:add('vehicle', nil, 'rotW', tostring(rot.w), "number", nil, nil, nil)
      end
      -- Write the connection/socket info.
      csv:add('connection', nil, '3rd Party Computation Time', tostring(compTime3rdParty[0]), 'number', nil, nil, nil)
      csv:add('connection', nil, 'Ping Time', tostring(pingTime[0]), 'number', nil, nil, nil)
      csv:add('connection', nil, '3rd Party Computation Time', tostring(compTime3rdParty[0]), 'number', nil, nil, nil)
      csv:add('connection', nil, 'Ping Time', tostring(pingTime[0]), 'number', nil, nil, nil)
      csv:add('connection', 'otherUDP', 'IP', ffi.string(sIP), 'string', nil, nil, nil)
      csv:add('connection', 'otherUDP', 'IP', ffi.string(sIP), 'string', nil, nil, nil)
      csv:add('connection', 'otherUDP', 'port', tostring(sPort[0]), 'number', nil, nil, nil)
      csv:add('connection', 'beamngUDP', 'IP', ffi.string(rIP), 'string', nil, nil, nil)
      csv:add('connection', 'beamngUDP', 'IP', ffi.string(rIP), 'string', nil, nil, nil)
      csv:add('connection', 'beamngUDP', 'port', tostring(rPort[0]), 'number', nil, nil, nil)
        local name = sensor.name
        csv:add('sensors', name, 'posX', tostring(sensor.pos.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posY', tostring(sensor.pos.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posX', tostring(sensor.pos.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posY', tostring(sensor.pos.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posZ', tostring(sensor.pos.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posY', tostring(sensor.pos.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posZ', tostring(sensor.pos.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirX', tostring(sensor.dir.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posZ', tostring(sensor.pos.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirX', tostring(sensor.dir.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirY', tostring(sensor.dir.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirX', tostring(sensor.dir.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirY', tostring(sensor.dir.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirZ', tostring(sensor.dir.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirY', tostring(sensor.dir.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirZ', tostring(sensor.dir.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upX', tostring(sensor.up.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirZ', tostring(sensor.dir.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upX', tostring(sensor.up.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upY', tostring(sensor.up.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upX', tostring(sensor.up.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upY', tostring(sensor.up.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upZ', tostring(sensor.up.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upY', tostring(sensor.up.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upZ', tostring(sensor.up.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'physicsUpdateTime', tostring(sensor.physicsUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upZ', tostring(sensor.up.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'physicsUpdateTime', tostring(sensor.physicsUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'GFXUpdateTime', tostring(sensor.GFXUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'physicsUpdateTime', tostring(sensor.physicsUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'GFXUpdateTime', tostring(sensor.GFXUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'isUsingGravity', tostring(sensor.isUsingGravity), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'GFXUpdateTime', tostring(sensor.GFXUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'isUsingGravity', tostring(sensor.isUsingGravity), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isAllowWheelNodes', tostring(sensor.isAllowWheelNodes), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isUsingGravity', tostring(sensor.isUsingGravity), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isAllowWheelNodes', tostring(sensor.isAllowWheelNodes), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'smootherStrength', tostring(sensor.smootherStrength), 'number', nil, nil, nil)
        csv:add('sensors', name, 'isAllowWheelNodes', tostring(sensor.isAllowWheelNodes), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'smootherStrength', tostring(sensor.smootherStrength), 'number', nil, nil, nil)
        csv:add('sensors', name, 'isVisualised', tostring(sensor.isVisualised), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'smootherStrength', tostring(sensor.smootherStrength), 'number', nil, nil, nil)
        csv:add('sensors', name, 'isVisualised', tostring(sensor.isVisualised), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isStatic', tostring(sensor.isStatic), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isVisualised', tostring(sensor.isVisualised), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isStatic', tostring(sensor.isStatic), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isSnappingDesired', tostring(sensor.isSnappingDesired), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isStatic', tostring(sensor.isStatic), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isSnappingDesired', tostring(sensor.isSnappingDesired), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isForceInsideTriangle', tostring(sensor.isForceInsideTriangle), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isSnappingDesired', tostring(sensor.isSnappingDesired), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isForceInsideTriangle', tostring(sensor.isForceInsideTriangle), 'boolean', nil, nil, nil)
      end
        local name = sensor.name
        csv:add('sensors', name, 'posX', tostring(sensor.pos.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posY', tostring(sensor.pos.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posX', tostring(sensor.pos.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posY', tostring(sensor.pos.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posZ', tostring(sensor.pos.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posY', tostring(sensor.pos.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posZ', tostring(sensor.pos.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirX', tostring(sensor.dir.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'posZ', tostring(sensor.pos.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirX', tostring(sensor.dir.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirY', tostring(sensor.dir.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirX', tostring(sensor.dir.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirY', tostring(sensor.dir.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirZ', tostring(sensor.dir.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirY', tostring(sensor.dir.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirZ', tostring(sensor.dir.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upX', tostring(sensor.up.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'dirZ', tostring(sensor.dir.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upX', tostring(sensor.up.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upY', tostring(sensor.up.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upX', tostring(sensor.up.x), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upY', tostring(sensor.up.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upZ', tostring(sensor.up.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upY', tostring(sensor.up.y), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upZ', tostring(sensor.up.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'physicsUpdateTime', tostring(sensor.physicsUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'upZ', tostring(sensor.up.z), 'number', nil, nil, nil)
        csv:add('sensors', name, 'physicsUpdateTime', tostring(sensor.physicsUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'GFXUpdateTime', tostring(sensor.GFXUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'physicsUpdateTime', tostring(sensor.physicsUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'GFXUpdateTime', tostring(sensor.GFXUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'isAllowWheelNodes', tostring(sensor.isAllowWheelNodes), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'GFXUpdateTime', tostring(sensor.GFXUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'isAllowWheelNodes', tostring(sensor.isAllowWheelNodes), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'refLon', tostring(sensor.refLon), 'number', nil, nil, nil)
        csv:add('sensors', name, 'isAllowWheelNodes', tostring(sensor.isAllowWheelNodes), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'refLon', tostring(sensor.refLon), 'number', nil, nil, nil)
        csv:add('sensors', name, 'refLat', tostring(sensor.refLat), 'number', nil, nil, nil)
        csv:add('sensors', name, 'refLon', tostring(sensor.refLon), 'number', nil, nil, nil)
        csv:add('sensors', name, 'refLat', tostring(sensor.refLat), 'number', nil, nil, nil)
        csv:add('sensors', name, 'isVisualised', tostring(sensor.isVisualised), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'refLat', tostring(sensor.refLat), 'number', nil, nil, nil)
        csv:add('sensors', name, 'isVisualised', tostring(sensor.isVisualised), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isStatic', tostring(sensor.isStatic), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isVisualised', tostring(sensor.isVisualised), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isStatic', tostring(sensor.isStatic), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isSnappingDesired', tostring(sensor.isSnappingDesired), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isStatic', tostring(sensor.isStatic), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isSnappingDesired', tostring(sensor.isSnappingDesired), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isForceInsideTriangle', tostring(sensor.isForceInsideTriangle), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isSnappingDesired', tostring(sensor.isSnappingDesired), 'boolean', nil, nil, nil)
        csv:add('sensors', name, 'isForceInsideTriangle', tostring(sensor.isForceInsideTriangle), 'boolean', nil, nil, nil)
      end
        local name = sensor.name
        csv:add('sensors', name, 'physicsUpdateTime', tostring(sensor.physicsUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'GFXUpdateTime', tostring(sensor.GFXUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'physicsUpdateTime', tostring(sensor.physicsUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'GFXUpdateTime', tostring(sensor.GFXUpdateTime), 'number', nil, nil, nil)
      end
        local name = sensor.name
        csv:add('sensors', name, 'physicsUpdateTime', tostring(sensor.physicsUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'GFXUpdateTime', tostring(sensor.GFXUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'physicsUpdateTime', tostring(sensor.physicsUpdateTime), 'number', nil, nil, nil)
        csv:add('sensors', name, 'GFXUpdateTime', tostring(sensor.GFXUpdateTime), 'number', nil, nil, nil)
      end
        -- Handle the individual row selection.
        local vName = tostring(veh.vid .. ": " .. veh.name .. " - " .. veh.jBeam)
        if im.Selectable1(vName, i == selectedVehicleIdx, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            if signal.isFrom then
              posStr, ctrCol = tostring(fromCtr), redB
              fromCtr = fromCtr + 1
            else
              posStr = tostring(toCtr)
              toCtr = toCtr + 1
@/lua/ge/extensions/editor/roadUtils.lua
                                                  tonumber(decorationSettings.zOff), decorationSettings.align == "true")
      decorationIDsString = decorationIDsString .. tostring(decoID) .. " "
      randomizeDecoration(decoID, tonumber(decorationSettings.randomFactor))
            editor.setDynamicFieldValue(decalID, "isDecal", "true", false)
            decalIDsString = decalIDsString .. tostring(decalID) .. " "
            decalNodes = {}
      local childRoadID = editor.createRoad(nodes, childRoadSettings)
      childIDsString = childIDsString .. tostring(childRoadID) .. " "
      editor.setDynamicFieldValue(childRoadID, "isChildRoad", "true", false)
@/lua/ge/extensions/flowgraph/nodes/ui/imgui/elemental/imButton.lua
  local avail = im.GetContentRegionAvail()
  im.Button(tostring(self.pinIn.text.value or "Button")  ..'##'.. tostring(self.id), im.ImVec2(avail.x, 0))
  local avail = im.GetContentRegionAvail()
  im.Button(tostring(self.pinIn.text.value or "Button")  ..'##'.. tostring(self.id), im.ImVec2(avail.x, 0))
@/lua/ge/extensions/editor/gen/ui.lua
local im = ui_imgui
--lo('== UI:'..tostring(im.IoFontsGetCount())) --..':'..tostring(im.GetColorU321(im.Col_WindowBg))..':'..tostring(im.Col_WindowBg))
local im = ui_imgui
--lo('== UI:'..tostring(im.IoFontsGetCount())) --..':'..tostring(im.GetColorU321(im.Col_WindowBg))..':'..tostring(im.Col_WindowBg))
local im = ui_imgui
--lo('== UI:'..tostring(im.IoFontsGetCount())) --..':'..tostring(im.GetColorU321(im.Col_WindowBg))..':'..tostring(im.Col_WindowBg))
--    D = rerequire(apack[4])
    	U.lo('>>++++++++++++++++ UI.reload:'..#apack..':'..tostring(D)) --..':'..tostring(D.forRoad()))
--    D = rerequire(apack[4])
    	U.lo('>>++++++++++++++++ UI.reload:'..#apack..':'..tostring(D)) --..':'..tostring(D.forRoad()))
		for key,p in pairs(aicon) do
--                U.dump(aicon[key], '?? for_icon:'..tostring(aicon[key]))
			dicon[key] = editor.texObj('/lua/ge/extensions/editor/gen/assets/_icon/'..(aicon[key][3] or key)..(p.suf or '.png'))
				if not W.out.invertedge then
					row[#row + 1] = {'Alt-Click', 'split '..tostring(scope)}
          if ({building=1,floor=1,wall=1})[scope] then
				else
					row[#row + 1] = {'Alt-Click', 'split '..tostring(splittable)}
				end
				if U._PRD == 0 and not W.out.invertedge then
					row[#row + 1] = {'Alt-Click', 'split '..tostring(splittable)}
				end
	count_inp = count_inp + 1
	if im.Combo1(tostring(count_inp), editor.getTempInt_NumberNumber(isel), comboItems, nil, nil) then
		local o = editor.getTempInt_NumberNumber()
--            lo('?? combo:'..lbl..':'..key..':'..isel)
--            lo('?? seld:'..tostring(o))
		env.onVal(key, o)
	count_inp = count_inp + 1
	if im['Input'..tp](tostring(count_inp), ptr, step) then
		env.onVal(key, ptr[0])
		count_inp = count_inp + 1
		lbl = tostring(count_inp)
	end
--  count_inp = count_inp + 1
--  local clbl = tostring(count_inp)
	local tp = isint and 'Int' or 'Float'
	if not env.ui[key] then
		lo('!! ERR_slider_noval:'..tostring(key))
		return
		env.onVal(key, text)
--          lo('?? ui.buttonT.matsel:'..tostring(W.out.curselect))
	end
--  count_inp = count_inp + 1
--  local clbl = tostring(count_inp)
  if im.Checkbox("##" .. lbl, ptr) then
--    lo('?? check:'..tostring(ptr[0])..':'..tostring(env))
  	env.onVal(key, ptr[0])
  if im.Checkbox("##" .. lbl, ptr) then
--    lo('?? check:'..tostring(ptr[0])..':'..tostring(env))
  	env.onVal(key, ptr[0])
	D = dec
--		U.lo('?? control:'..tostring(D))
	R = reg
	cforest = W.ifForest()
--		if cforest then print('??*************** UI.if_CFOR:'..tostring(cforest)) end
	local desc = W.forDesc()
	local insector = W.out.Ter and W.out.Ter.out.insector
--		print('?? if_LAT:'..tostring(editor.beginWindow('LAT', 'WIP_Landscape_Gen')))
				nil, bgcolor, 'MultiSelectButton') then
					U.lo('?? ui.to_conform:'..tostring(W.out.D.forRoad()))
				W.out.avedit = {}
						env.onVal('building_shape', key)
--                            lo('?? for_shape:'..tostring(W.ui.building_shape))
					else
				end
--                    U.dump(list, '??*********** for_list:'..tp..':'..tostring(#list[1])..':'..tostring(type(list[1])))
--                    _dbgone = true
				end
--                    U.dump(list, '??*********** for_list:'..tp..':'..tostring(#list[1])..':'..tostring(type(list[1])))
--                    _dbgone = true
				elseif not _dbgone then
					lo('!! ERR_ui.NO_DAE:'..tostring(tp))
					_dbgone = true
				end
--						U.dump(mlist,'?? if_LIST2:'..tp..':'..tostring(meshType)) --type(mlist[1])..':'..tostring(mlist and #mlist or nil))
				break
				end
--						U.dump(mlist,'?? if_LIST2:'..tp..':'..tostring(meshType)) --type(mlist[1])..':'..tostring(mlist and #mlist or nil))
				break
			for i,s in pairs(list) do
				list[i] = tostring(list[i])
			end
				local o = editor.getTempInt_NumberNumber()
					lo('?? UI.sel1:'..o..':'..tostring(W)..':'..tostring(meshType))
				local s = list[o+1]
				local o = editor.getTempInt_NumberNumber()
					lo('?? UI.sel1:'..o..':'..tostring(W)..':'..tostring(meshType))
				local s = list[o+1]
					if D.forRoad() then
						D.matApply(tostring(s))
					else
					else
						W.matApply(tostring(s), o)
					end
				for o,s in pairs(list) do
		--            lo('?? for_mat:'..tostring(s))
		--            im.TextColored(im.ImVec4(0.5, 0.5, 0.7, 1), tostring(s))
		--            lo('?? for_mat:'..tostring(s))
		--            im.TextColored(im.ImVec4(0.5, 0.5, 0.7, 1), tostring(s))
		--            im.SameLine()
					local selected = (o == W.out.curselect)
					if im.Selectable1(tostring(s), selected) then
							lo('?? UI.sel2:'..o..':'..tostring(W)..':'..tostring(meshType))
					if im.Selectable1(tostring(s), selected) then
							lo('?? UI.sel2:'..o..':'..tostring(W)..':'..tostring(meshType))
						if D.forRoad() then
					if im.Selectable1(tostring(s), selected) then
							lo('?? UI.sel2:'..o..':'..tostring(W)..':'..tostring(meshType))
						if D.forRoad() then
						if D.forRoad() then
							D.matApply(tostring(s))
						else
						else
							W.matApply(tostring(s), o)
						end
							if D.forRoad() then
								D.matApply(tostring(s))
							else
							else
								W.matApply(tostring(s), o)
							end
							if color ~= colorOff then
									lo('?? ui.to_pop:'..tostring(R))
								W.out.avedit = {}
						nil, bgcolor, 'MultiSelectButton') then
							U.lo('?? ui.to_conform:'..tostring(W.out.D.forRoad()))
						W.out.avedit = {}
						nil, bgcolor, 'MultiSelectButton') then
							U.lo('?? ui.to_conform:'..tostring(W.out.D.forRoad()))
						W.out.avedit = {}
]]
--				print('?? for_ML:'..tostring(mlist and #mlist or nil)..':'..tostring(meshType))
--            im.
]]
--				print('?? for_ML:'..tostring(mlist and #mlist or nil)..':'..tostring(meshType))
--            im.
			for i,s in pairs(mlist) do
				mlist[i] = tostring(mlist[i])
			end
				local o = editor.getTempInt_NumberNumber()
					lo('?? UI.sel:'..o..':'..tostring(W)..':'..tostring(meshType))
				local s = mlist[o+1]
				local o = editor.getTempInt_NumberNumber()
					lo('?? UI.sel:'..o..':'..tostring(W)..':'..tostring(meshType))
				local s = mlist[o+1]
-- ROAD CONTROLS
		--                    lo('?? mat:'..tostring(croad:getField("material", "")))
		--            im.SameLine()
					elseif cforest then
--							print('?? UI_cfor:'..tostring(cforest)..':'..tostring(W.ifForest({'gutter'})))
--					elseif W.ifForest() then
					elseif cforest then
--							print('?? UI_cfor:'..tostring(cforest)..':'..tostring(W.ifForest({'gutter'})))
--					elseif W.ifForest() then
							if W.ui.dbg  then
								lo('??^^^^^^^^^^^^^^ UI_dbg:'..tostring(desc)..':'..tostring(desc.afloor[#desc.afloor].top))
								W.ui.dbg = false
							if W.ui.dbg  then
								lo('??^^^^^^^^^^^^^^ UI_dbg:'..tostring(desc)..':'..tostring(desc.afloor[#desc.afloor].top))
								W.ui.dbg = false
									base = desctop.base
				--                                        lo('?? for_DT:'..tostring(desctop.ridge.on)..':'..tostring(base))
								else
									base = desctop.base
				--                                        lo('?? for_DT:'..tostring(desctop.ridge.on)..':'..tostring(base))
								else
									base = desctop.base
--                                        lo('?? for_DT:'..tostring(desctop.ridge.on)..':'..tostring(base))
								else
									base = desctop.base
--                                        lo('?? for_DT:'..tostring(desctop.ridge.on)..':'..tostring(base))
								else
--            im.Text("Clients:")
--            im.Text("Clients:"..tostring(im.GetCursorPos().x)..':'..tostring(im.GetCursorPos().y))
		end
--            im.Text("Clients:")
--            im.Text("Clients:"..tostring(im.GetCursorPos().x)..':'..tostring(im.GetCursorPos().y))
		end

		SCNow['Ctrl-Click'] = 'new building'..'::'..tostring(scope) --..':'..tostring(W.out.scope)
		if scope then

		SCNow['Ctrl-Click'] = 'new building'..'::'..tostring(scope) --..':'..tostring(W.out.scope)
		if scope then
		if toupdate then
				lo('?? SC_UPDATE:'..tostring(W.forScope()))
			toupdate = false
		editMode.auxShortcuts = {}
		editMode.auxShortcuts['Alt-Click'] = 'new building'..'::'..tostring(W.out.scope)
--        editMode.auxShortcuts[editor.AuxControl_Copy] = nil -- "Copy objects"
--            im.Text("Clients:")
--            im.Text("Clients:"..tostring(im.GetCursorPos().x)..':'..tostring(im.GetCursorPos().y))
	end
--            im.Text("Clients:")
--            im.Text("Clients:"..tostring(im.GetCursorPos().x)..':'..tostring(im.GetCursorPos().y))
	end
local function hint(emode)
--		lo('>> hint:'..tostring(emode))
	editMode = emode
@/lua/ge/extensions/editor/missionPlaybook/attributeViewer.lua
        im.NextColumn()
        im.Text(tostring(data.attributes[key].value))
        im.NextColumn()
        if change > 0 then
          im.TextColored(colorGreen, "+"..tostring(change))
        elseif change < 0 then
        elseif change < 0 then
          im.TextColored(colorRed, tostring(change))
        end
@/gameplay/missionTypes/drift/customNodes/updateTaskListObjectivesNode.lua
    if type(value) == 'string' or type(value) == 'number' then
      context[key] = tostring(value)
    end
@/lua/ge/extensions/core/schemeCommandServer.lua

    log('D', "schemeCommandServer", "got '" .. tostring(data) .. "' from "..tostring(ip) .. ":" .. tostring(port))

    log('D', "schemeCommandServer", "got '" .. tostring(data) .. "' from "..tostring(ip) .. ":" .. tostring(port))

    log('D', "schemeCommandServer", "got '" .. tostring(data) .. "' from "..tostring(ip) .. ":" .. tostring(port))
@/lua/ge/extensions/flowgraph/nodes/vehicle/special/wheelDistance.lua
    end
    print(tostring(distanceFromStart))
@/lua/ge/extensions/editor/gen/exp_frame.lua
        if not ind and g then
--            lo('?? build:'..tostring(g))
--            U.dump(ac, '?? AC:')
        end
        lo('>> build:'..tostring(ind)..':'..tostring(g))
    local i = 1
        end
        lo('>> build:'..tostring(ind)..':'..tostring(g))
    local i = 1
        if ind and ind[2] == 1 then
            lo('?? fr_PR:'..tostring(v1)..'>'..tostring(v2)..' tib:'..tostring(body.tibia_l.r))
            local t2 = U.vturn3D(body.tibia_l.r,v1,v2)
        if ind and ind[2] == 1 then
            lo('?? fr_PR:'..tostring(v1)..'>'..tostring(v2)..' tib:'..tostring(body.tibia_l.r))
            local t2 = U.vturn3D(body.tibia_l.r,v1,v2)
        if ind and ind[2] == 1 then
            lo('?? fr_PR:'..tostring(v1)..'>'..tostring(v2)..' tib:'..tostring(body.tibia_l.r))
            local t2 = U.vturn3D(body.tibia_l.r,v1,v2)
--            local t2 = U.vturn3D(body.tibia_l.r,v1,v2)
            lo('?? to_TIB:'..tostring(body.tibia_l.r)..':'..tostring(t2))
        end
--            local t2 = U.vturn3D(body.tibia_l.r,v1,v2)
            lo('?? to_TIB:'..tostring(body.tibia_l.r)..':'..tostring(t2))
        end
    --- pelvic
--        lo('?? pelv_r:'..tostring(forEdge('pelvic'))..':'..body.pelvic.dir)
    dnode['p_'..copp] = dnode['p_'..cfix] + forEdge('pelvic')
        local p = W.dmove[cmove].cp
--            lo('?? to_target:'..tostring(p)..':'..tostring(U.proj2D(dnode[body.sternum.frto[1]])))
        local aw = {1,1,1,0.5}
        local p = W.dmove[cmove].cp
--            lo('?? to_target:'..tostring(p)..':'..tostring(U.proj2D(dnode[body.sternum.frto[1]])))
        local aw = {1,1,1,0.5}
--            if not ind and nmove % ndump == 1 then
--                lo('?? for_TIB:'..nmove..':'..a..':'..tostring(body.pelvic.r)..':'..tostring(v)..':'..v:length()) --..':'..a)
--            end
--            if not ind and nmove % ndump == 1 then
--                lo('?? for_TIB:'..nmove..':'..a..':'..tostring(body.pelvic.r)..':'..tostring(v)..':'..v:length()) --..':'..a)
--            end
                if not ind and nmove%100 == 1 then
                    lo('?? for_ANG:'..v:length()..':'..tostring(v:normalized())..':'..a)
                end
                lo('?? for_W:'..nmove
                    ..':'..tostring(dnode[body.sternum.frto[1]])
                    ..':'..tostring(dnode[body.femur_l.frto[1]])
                    ..':'..tostring(dnode[body.sternum.frto[1]])
                    ..':'..tostring(dnode[body.femur_l.frto[1]])
                    ) --..' d:'..d..':'..' a:'..a..' w:'..w..':'..((cL-L)/cL))
            -- reset
--                lo('?? pp:'..nmove..' p:'..tostring(p)..':'..U.proj2D(pmid):distance(pos))
            local pnew = pcent + (W.dmove[cmove].cp - pcent):normalized()*W.dmove[cmove].ptarget:length()
--            local pnew = U.proj2D(pos) + (W.dmove[cmove].p - pos):normalized()*6
--                lo('?? no_IND:'..tostring((W.dmove[cmove].cp - pos):normalized())..':'..tostring((W.dmove[cmove].p - pos):normalized()))
--                lo('?? no_IND:'..nmove..':'..tostring(pos)..':'..tostring(W.dmove[cmove].p)..'>'..tostring(pnew))
--            local pnew = U.proj2D(pos) + (W.dmove[cmove].p - pos):normalized()*6
--                lo('?? no_IND:'..tostring((W.dmove[cmove].cp - pos):normalized())..':'..tostring((W.dmove[cmove].p - pos):normalized()))
--                lo('?? no_IND:'..nmove..':'..tostring(pos)..':'..tostring(W.dmove[cmove].p)..'>'..tostring(pnew))
--                lo('?? no_IND:'..tostring((W.dmove[cmove].cp - pos):normalized())..':'..tostring((W.dmove[cmove].p - pos):normalized()))
--                lo('?? no_IND:'..nmove..':'..tostring(pos)..':'..tostring(W.dmove[cmove].p)..'>'..tostring(pnew))
            pnew.z = 0
--                lo('?? no_IND:'..tostring((W.dmove[cmove].cp - pos):normalized())..':'..tostring((W.dmove[cmove].p - pos):normalized()))
--                lo('?? no_IND:'..nmove..':'..tostring(pos)..':'..tostring(W.dmove[cmove].p)..'>'..tostring(pnew))
            pnew.z = 0
--                lo('?? no_IND:'..tostring((W.dmove[cmove].cp - pos):normalized())..':'..tostring((W.dmove[cmove].p - pos):normalized()))
--                lo('?? no_IND:'..nmove..':'..tostring(pos)..':'..tostring(W.dmove[cmove].p)..'>'..tostring(pnew))
            pnew.z = 0
--            W.dmove[cmove].p = pmid + (W.dmove[cmove].p - pos):normalized()*4
--            lo('?? no_IND:'..nmove..':'..tostring(pos)..':'..tostring(W.dmove[cmove].p)..'>'..tostring(pnew))
        end
--            W.dmove[cmove].p = pmid + (W.dmove[cmove].p - pos):normalized()*4
--            lo('?? no_IND:'..nmove..':'..tostring(pos)..':'..tostring(W.dmove[cmove].p)..'>'..tostring(pnew))
        end
--            W.dmove[cmove].p = pmid + (W.dmove[cmove].p - pos):normalized()*4
--            lo('?? no_IND:'..nmove..':'..tostring(pos)..':'..tostring(W.dmove[cmove].p)..'>'..tostring(pnew))
        end
--        if not ind then
--            U.dump(ac,'??^^^^^^^^^^^^^^^^^^^ loss_NI:'..tostring(g))
--        end
    if not ind and not g then
--        lo('?? l_DUMP:'..tostring(dw))
        sdw = deepcopy(dw)
    if ind then
--        lo('?? loss_ind2:'..ind..':'..tostring(sc)..':'..sc[3]..':'..sc[1][sc[2]])
--        sc[1][sc[2]] = sc[3]
        adw[ind[2]] = deepcopy(dw)
--            lo('?? if_IND:'..tostring(ind))
        if sdw then
    local cac = deepcopy(ac)
--    lo('?? step:'..#ac..' i:'..i..' s:'..tostring(s))
    cac[i] = cac[i] + s
--        {vec3(-0.2,-0,-0),vec3(0.1999200027,0.007999466677,0)})
--        lo('?? if_TL:'..tostring(d))
--        if true then return end
--    body.sternum.fix = true
        lo('>> test:'..tostring(state))
    if state then
    L = loss(aa)
        lo('?? for_L0:'..tostring(L)..':'..#aa)
    for k,c in pairs(aa) do
--    cL,L,cac = AI.go2(aa, loss, step, epo/2, 0.01, afix)
        U.dump(cac,'?? for_L2:'..tostring(cL))
    -- render
W.onVal = function(key,val)
        lo('>> '..wlabel..'.onVal:'..key..'/'..tostring(ckey)..':'..tostring(val)..':'..tostring(adw and #adw or nil))
    if not adw or #adw < key then return end
W.onVal = function(key,val)
        lo('>> '..wlabel..'.onVal:'..key..'/'..tostring(ckey)..':'..tostring(val)..':'..tostring(adw and #adw or nil))
    if not adw or #adw < key then return end
W.onVal = function(key,val)
        lo('>> '..wlabel..'.onVal:'..key..'/'..tostring(ckey)..':'..tostring(val)..':'..tostring(adw and #adw or nil))
    if not adw or #adw < key then return end
    ckey = key
--        lo('?? onVal:'..tostring(ckey))
end
    env = W
--        lo('?? exp_sf.ui:'..tostring(wnm)..':'..tostring(editor.isWindowRegistered(wnm)))
    if wnm then
    env = W
--        lo('?? exp_sf.ui:'..tostring(wnm)..':'..tostring(editor.isWindowRegistered(wnm)))
    if wnm then
            hasfocus = true
--                lo('?? exp_sf.ui2:'..tostring(wlabel))
--            im.Text('HELLO_'..wlabel)

            im.Text(U.round(L,6) or tostring(nil))
            im.SameLine()
--                            UI.buttonTxt('key_'..ord,U.round(d.g[i],6))
                            im.Text(U.round(d.g[i],6) or tostring(nil))
                        end
                        end
    --                    im.Text(grad and U.round(grad[ord],6) or tostring(nil))
                        im.NextColumn()
                im.NextColumn()
                im.Text(tostring(dw[key]))
                tot = tot + dw[key]
    local ttime = os.clock()
--        lo('?? tt:'..tostring(cmove))
    if ttime - ctime > 0.02 and cmove then
    --    cL,L,cac = AI.go2(aa, loss, step, epo/2, 0.01, afix)
--            U.dump(cac,'?? for_L2:'..tostring(cL))
        render()
                    ,{'tmp','eframe'}, 'frame.json')
                U.dump(dnode,'?? DONE:'..nStep..':'..nmove..':'..tostring(dmove[smove].ptarget))
            end
    if im.IsMouseReleased(0) and inview and rayCast then
        lo('?? mDOWN:'..tostring(rayCast.pos)..':'..tostring(_dbg))
        if not _dbg then
    if im.IsMouseReleased(0) and inview and rayCast then
        lo('?? mDOWN:'..tostring(rayCast.pos)..':'..tostring(_dbg))
        if not _dbg then
            cfix = dr < dl and 'l' or 'r'
                lo('?? cmove:'..tostring(cmove))
        end
                ,{'tmp','eframe'}, 'frame.json')
                U.dump(dnode,'?? state_DUMP:'..nStep..':'..nmove..':'..tostring(dmove[cmove].ptarget))
            smove = cmove
@/lua/ge/extensions/editor/objectTool.lua
    if obj then
      --editor.logDebug("Copy id " .. tostring(obj:getId()));
      local memento = editor.saveSimObjectMemento(obj)
  for k = 1, tableSize(classes) do
    imgui.PushID1(tostring(k))
    local isSel = tableContains(hiddenObjectIconClasses, classes[k])
@/lua/ge/extensions/editor/resourceChecker.lua
  local objs = scenetree.getAllObjects()
  --log('E', '', '# objects existing: ' .. tostring(#scenetree.getAllObjects()))
  for _, objName in ipairs(objs) do
  return ret
  --log('E', '', '# objects left: ' .. tostring(#scenetree.getAllObjects()))
end
        if (count % 2 == 0) then
          drawRectBg(tostring(k), im.ImVec4(1, 1, 1, 0.06))
        end
            if (count % 2 == 0) then
              drawRectBg(tostring(l), im.ImVec4(1, 1, 1, 0.06))
            end
                    if (count % 2 == 0) then
                      drawRectBg(tostring(j), im.ImVec4(1, 1, 1, 0.06))
                    end
                    end
                    if j ~= "Stages" then im.Text(j..": "..tostring(c)) end
                    if im.IsItemHovered() and im.IsMouseClicked(1) then
                            if (count % 2 == 0) then
                              drawRectBg(tostring(stage), im.ImVec4(1, 1, 1, 0.06))
                            end
                                if (count % 2 == 0) then
                                  drawRectBg(tostring(x), im.ImVec4(1, 1, 1, 0.06))
                                end
                                  for a,f in pairs(x) do
                                    txtstring = txtstring..tostring(f)..", "
                                  end
                                else
                                  im.Text(m..": "..tostring(x))
                                  if im.IsItemHovered() and type(x) == "string" then
    else
      im.Text('['..tostring(res)..']')
    end
        if o and o.getFileName then
          if FS:fileExists(o:getFileName()) then Engine.Platform.exploreFolder(o:getFileName()) else log('E', '', 'Path :'..tostring(o:getFileName())..' does not exist' ) end
        end
        end
        if FS:fileExists(res) then Engine.Platform.exploreFolder(res) else log('E', '', 'Path :'..tostring(res)..' does not exist' ) end
      end
          end
        else log('E', '', 'Path :'..tostring(res)..' does not exist' ) end
      end
        end
        if FS:fileExists(res) then im.SetClipboardText(res) else log('E', '', 'Path :'..tostring(res)..' does not exist' ) end
        im.CloseCurrentPopup()
        end
        if FS:fileExists(res) then dump(FS:stat(res)) else log('E', '', 'Path :'..tostring(res)..' does not exist' ) end
        im.CloseCurrentPopup()
          if (count % 2 == 0) then
            drawRectBg(tostring(k), im.ImVec4(1, 1, 1, 0.06))
          end
          if im.IsItemHovered() then
            drawRectBg(tostring(k), im.ImVec4(0.2, 0.24, 0.31, 0.78), 1)
          end
                    isSelected[i] = true
                    drawRectBg(tostring(i), im.ImVec4(0.8, 0.4, 0.1, 1))
                    im.TextColored(im.ImVec4(1, 1, 1, 1), '  '..i..": ")
                  else
                    drawRectBg(tostring(i), im.ImVec4(1, 1, 1, 0.06))
                    im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), '  '..i..": ")
                    isSelected[i] = true
                    drawRectBg(tostring(i), im.ImVec4(0.8, 0.4, 0.1, 1))
                    im.TextColored(im.ImVec4(1, 1, 1, 1), '  '..i..": ")
                  else
                    drawRectBg(tostring(i), im.ImVec4(0, 0, 0, 0.1))
                    im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), '  '..i..": ")
                elseif im.IsItemHovered() then
                  drawRectBg(tostring(i), im.ImVec4(0.2, 0.24, 0.31, 0.78), 1)
                  texHovered(i)
                          isSelected[d] = true
                          drawRectBg(tostring(d), im.ImVec4(0.8, 0.4, 0.1, 1))
                          im.TextColored(im.ImVec4(1, 1, 1, 1), '    '..d..": ")
                        else
                          drawRectBg(tostring(d), im.ImVec4(1, 1, 1, 0.06))
                          im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), '    '..d..": ")
                          isSelected[d] = true
                          drawRectBg(tostring(d), im.ImVec4(0.8, 0.4, 0.1, 1))
                          im.TextColored(im.ImVec4(1, 1, 1, 1), '    '..d..": ")
                        else
                          drawRectBg(tostring(d), im.ImVec4(0, 0, 0, 0.1))
                          im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), '    '..d..": ")
                      elseif im.IsItemHovered() then
                        drawRectBg(tostring(d), im.ImVec4(0.2, 0.24, 0.31, 0.78), 1)
                        matHovered(d)
                                isSelected[o] = true
                                drawRectBg(tostring(o), im.ImVec4(0.8, 0.4, 0.1, 1))
                                im.TextColored(im.ImVec4(1, 1, 1, 1), '      '..a..": "..o)
                              else
                                drawRectBg(tostring(o), im.ImVec4(1, 1, 1, 0.06))
                                im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), '      '..a..": "..o)
                                isSelected[o] = true
                                drawRectBg(tostring(o), im.ImVec4(0.8, 0.4, 0.1, 1))
                                im.TextColored(im.ImVec4(1, 1, 1, 1), '      '..a..": "..o)
                              else
                                drawRectBg(tostring(o), im.ImVec4(0, 0, 0, 0.1))
                                im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), '      '..a..": "..o)
                            elseif im.IsItemHovered() then
                              drawRectBg(tostring(o), im.ImVec4(0.2, 0.24, 0.31, 0.78), 1)
                              texHovered(path)
          if isDoubleClicked[k] == true then
            drawRectBg(tostring(k), im.ImVec4(0.8, 0.4, 0.1, 1))
            im.TextColored(im.ImVec4(1, 1, 1, 1), tostring(k))
            drawRectBg(tostring(k), im.ImVec4(0.8, 0.4, 0.1, 1))
            im.TextColored(im.ImVec4(1, 1, 1, 1), tostring(k))
          else
          else
            drawRectBg(tostring(k), im.ImVec4(1, 1, 1, 0.06))
            im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), tostring(k))
            drawRectBg(tostring(k), im.ImVec4(1, 1, 1, 0.06))
            im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), tostring(k))
          end
          if isDoubleClicked[k] == true then
            drawRectBg(tostring(k), im.ImVec4(0.8, 0.4, 0.1, 1))
            im.TextColored(im.ImVec4(1, 1, 1, 1), tostring(k))
            drawRectBg(tostring(k), im.ImVec4(0.8, 0.4, 0.1, 1))
            im.TextColored(im.ImVec4(1, 1, 1, 1), tostring(k))
          else
          else
            im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), tostring(k))
          end
      if testName == "matVersion" or testName == "unusedMat" then
        local matName = tostring(v):match("^(%S+)%s+(.+)")
        resourceContextMenu(matName, count, 'material')
      elseif testName == "usedMat" then
        local matName = tostring(v):match("^(%S+)%s+(.+)")
        resourceContextMenu(matName, count, 'usedMat', filepath)
      else
        path = tostring(v):match(".*. (.+)")
        if path and FS:fileExists(path) then
        if path and FS:fileExists(path) then
        elseif tostring(v) and string.match(tostring(v), " ") then
          path = tostring(v):match("^(%S+)%s+(.+)")
        if path and FS:fileExists(path) then
        elseif tostring(v) and string.match(tostring(v), " ") then
          path = tostring(v):match("^(%S+)%s+(.+)")
        elseif tostring(v) and string.match(tostring(v), " ") then
          path = tostring(v):match("^(%S+)%s+(.+)")
          if path and FS:fileExists(path) then end
        else
          path = tostring(v)
        end
            isSelected[v] = true
            drawRectBg(tostring(v), im.ImVec4(0.8, 0.4, 0.1, 1))
            im.TextColored(im.ImVec4(1, 1, 1, 1), tostring(v))
            drawRectBg(tostring(v), im.ImVec4(0.8, 0.4, 0.1, 1))
            im.TextColored(im.ImVec4(1, 1, 1, 1), tostring(v))
          else
          else
            drawRectBg(tostring(v), im.ImVec4(1, 1, 1, 0.06))
            im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), tostring(v))
            drawRectBg(tostring(v), im.ImVec4(1, 1, 1, 0.06))
            im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), tostring(v))
          end
            isSelected[v] = true
            drawRectBg(tostring(v), im.ImVec4(0.8, 0.4, 0.1, 1))
            im.TextColored(im.ImVec4(1, 1, 1, 1), tostring(v))
            drawRectBg(tostring(v), im.ImVec4(0.8, 0.4, 0.1, 1))
            im.TextColored(im.ImVec4(1, 1, 1, 1), tostring(v))
          else
          else
            drawRectBg(tostring(v), im.ImVec4(0, 0, 0, 0.1))
            im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), tostring(v))
            drawRectBg(tostring(v), im.ImVec4(0, 0, 0, 0.1))
            im.TextColored(im.ImVec4(0.5, 0.9, 1, 1), tostring(v))
          end
        if testName == "matVersion" or testName == "unusedMat" or testName == "usedMat" then
          local matName = tostring(v):match("^(%S+)%s+(.+)")
          im.OpenPopup("Popup_" .. matName..count)
      elseif im.IsItemHovered() then
        drawRectBg(tostring(v), im.ImVec4(0.2, 0.24, 0.31, 0.78), 1)
        if testName == "matVersion" or testName == "unusedMat" or testName == "usedMat" then
        if testName == "matVersion" or testName == "unusedMat" or testName == "usedMat" then
          matHovered(tostring(v):match("^(%S+)%s+(.+)"))
        elseif testName == "duplicates" then
        elseif testName == "duplicates" then
          matHovered(tostring(v))
        elseif testName == "tsstatics" or testName == "forestitems" or testName == "unusedMesh" or testName == "missingMat" or testName == "colData" then
        elseif testName == "tsstatics" or testName == "forestitems" or testName == "unusedMesh" or testName == "missingMat" or testName == "colData" then
          if FS:fileExists(tostring(v)) then
            shapeHovered(tostring(v))
          if FS:fileExists(tostring(v)) then
            shapeHovered(tostring(v))
          else
          else
            shapeHovered(tostring(v):match("^(%S+)%s+(.+)"))
          end
        else
          texHovered(tostring(v))
        end
  if FS:fileExists(path) then Engine.Platform.exploreFolder(path)
  else log('E','', 'Path :'..tostring(path)..' does not exist') end
end

    if n.isDir then im.Text(tostring(n.files or 0)) else im.Text("1") end
    im.NextColumn()

    im.Text(tostring(n.subdirs or 0))
    im.NextColumn()
          im.TextColored(im.ImVec4(1,1,1,1), "Scene object counts")
          im.Text("TSStatic: "..tostring(scene.TSStatic))
          im.Text("ForestItems: "..tostring(scene.ForestItems))
          im.Text("TSStatic: "..tostring(scene.TSStatic))
          im.Text("ForestItems: "..tostring(scene.ForestItems))
          im.Text("TerrainBlock: "..tostring(scene.TerrainBlock))
          im.Text("ForestItems: "..tostring(scene.ForestItems))
          im.Text("TerrainBlock: "..tostring(scene.TerrainBlock))
          im.Text("DecalRoad: "..tostring(scene.DecalRoad))
          im.Text("TerrainBlock: "..tostring(scene.TerrainBlock))
          im.Text("DecalRoad: "..tostring(scene.DecalRoad))
          im.Text("MeshRoad: "..tostring(scene.MeshRoad))
          im.Text("DecalRoad: "..tostring(scene.DecalRoad))
          im.Text("MeshRoad: "..tostring(scene.MeshRoad))
          im.Text("Lights (Point/Spot): "
          im.Text("Lights (Point/Spot): "
            ..tostring(scene.PointLight).."/"
            ..tostring(scene.SpotLight))
            ..tostring(scene.PointLight).."/"
            ..tostring(scene.SpotLight))
          im.Text("SFXEmitter: "..tostring(scene.SFXEmitter))
            ..tostring(scene.SpotLight))
          im.Text("SFXEmitter: "..tostring(scene.SFXEmitter))
          im.Text("SFXSpace: "..tostring(scene.SFXSpace))
          im.Text("SFXEmitter: "..tostring(scene.SFXEmitter))
          im.Text("SFXSpace: "..tostring(scene.SFXSpace))
          im.EndTabItem()
@/lua/ge/extensions/flowgraph/nodes/debug/debugText.lua
  end
  debugDrawer:drawTextAdvanced(pos, String(tostring(self.pinIn.text.value)), clr, true, false, clrBG, false, false)
end
@/lua/ge/extensions/editor/tech/roadArchitect/roadMesh.lua
  local mesh = createObject('ProceduralMesh')
  mesh:registerObject('Sidewalk_' .. tostring(roadMeshIdx) .. '_' .. tostring(s))
  mesh.canSave = true
  local mesh = createObject('ProceduralMesh')
  mesh:registerObject('Sidewalk_' .. tostring(roadMeshIdx) .. '_' .. tostring(s))
  mesh.canSave = true
  local mesh = createObject('ProceduralMesh')
  mesh:registerObject('Curb_' .. tostring(roadMeshIdx) .. '_' .. tostring(s))
  mesh.canSave = true
  local mesh = createObject('ProceduralMesh')
  mesh:registerObject('Curb_' .. tostring(roadMeshIdx) .. '_' .. tostring(s))
  mesh.canSave = true
  local mesh = createObject('ProceduralMesh')
  mesh:registerObject('Sidewalk_' .. tostring(roadMeshIdx) .. '_' .. tostring(s))
  mesh.canSave = true
  local mesh = createObject('ProceduralMesh')
  mesh:registerObject('Sidewalk_' .. tostring(roadMeshIdx) .. '_' .. tostring(s))
  mesh.canSave = true
  local mesh = createObject('ProceduralMesh')
  mesh:registerObject('Curb_' .. tostring(roadMeshIdx) .. '_' .. tostring(s))
  mesh.canSave = true
  local mesh = createObject('ProceduralMesh')
  mesh:registerObject('Curb_' .. tostring(roadMeshIdx) .. '_' .. tostring(s))
  mesh.canSave = true
  local mesh = createObject('ProceduralMesh')
  mesh:registerObject('Bridge_' .. tostring(r.name))
  mesh.canSave = true
@/lua/vehicle/controller/vehicleController/shiftLogic/dctGearbox.lua
  if M.currentGearIndex ~= 0 then
    return modePrefix ~= "" and modePrefix .. tostring(M.currentGearIndex) or automaticHandling.mode
  else
      --instead of actually using M1, we want to KEEP the current gear, so M
      automaticHandling.mode = "M" .. tostring(max(gearbox.gearIndex, 1))
    end
    --instead of actually using M1, we want to KEEP the current gear, so M
    automaticHandling.mode = "M" .. tostring(max(gearbox.gearIndex, 1))
  end
    --instead of actually using M1, we want to KEEP the current gear, so M
    automaticHandling.mode = "M" .. tostring(max(gearbox.gearIndex, 1))
  end
        for j = 1, gearbox.maxGearIndex, 1 do
          local manualMode = "M" .. tostring(j)
          local manualModeIndex = i + j - 1
@/lua/vehicle/bdebugImpl.lua
  if node.name == nil then
    obj.debugDrawProxy:drawNodeText(node.cid, col, "[" .. tostring(node.cid) .. "] " .. txt, nodeDisplayDistance)
  else
  else
    obj.debugDrawProxy:drawNodeText(node.cid, col, tostring(node.name) .. " " .. txt, nodeDisplayDistance)
  end
        local text = data.textList[i]
        obj:queueGameEngineLua('debugDrawer:drawTextAdvanced(' .. tostring(nodePos) .. ',"' .. text .. '",ColorF(1,1,1,1),true,false,ColorI(0,0,0,192))')
      end
local function getNodeText(node, txt)
  return node.name == nil and "[" .. tostring(node.cid) .. "]" .. (txt and ' ' .. txt or '') or tostring(node.name) .. (txt and ' ' .. txt or '')
end
local function getNodeText(node, txt)
  return node.name == nil and "[" .. tostring(node.cid) .. "]" .. (txt and ' ' .. txt or '') or tostring(node.name) .. (txt and ' ' .. txt or '')
end
        local node = v.data.nodes[i]
        local nodeText = tostring(node.cid)
        text = k ~= tblSize and text .. nodeText .. ', ' or text .. nodeText
        else
          txt = '{' .. tostring(node.group or '') .. '}'
        end
@/lua/vehicle/props.lua
      if not (prop.hidden and prop.disabled) then
        -- log('D', "props.hidePropsInBreakGroup", "prop hidden: ".. tostring(breakGroup))
        prop.disabled = true
@/lua/ge/extensions/scenario/damageGoal.lua
        if (progress - instance.lastProgress) >= thresholdPercentage then
          local progressStr = tostring(progress)
          if instance.value.purpose == "win" then
      if instance.value.damageLimit and type(instance.value.damageLimit) ~= "number" then
        log('E', 'In '..tostring(scenario.name), ' damageLimit must contain number value  ')
        goto continue
      if instance.value.damageThreshold and type(instance.value.damageThreshold) ~= "number" then
        log('E', 'In '..tostring(scenario.name), ' damageThreshold must contain number value  ')
        goto continue
      if instance.value.purpose and type(instance.value.purpose)~="string" then
        log('E', 'In '..tostring(scenario.name),'purpose is missing in json file or purpose has wrong type ')
        goto continue
@/lua/ge/extensions/gameplay/drift/bounds.lua
    if im.Begin("Drift bounds") then
      im.Text("Is out of bounds : " ..tostring(isOutOfBounds))
    end
@/gameplay/missionTypes/aiRace/customNodes/getRankStringNode.lua
  if self.pinIn.placement.value >= 1 and self.pinIn.placement.value <= 10 then -- top 10 placements have translation strings
    self.pinOut.rankStr.value = translateLanguage('missions.aiRace.general.rank'..self.pinIn.placement.value, tostring(self.pinIn.placement.value))
  else
@/lua/ge/server/server.lua
  end
  --log('I', logTag, 'Loading = '..tostring(core_gamestate.loading()))
  -- yes this is weird, but it fixes the problem with createGame and luaPreRender
@/lua/ge/extensions/tech/adasUltrasonic.lua
  be:queueObjectLua(vid, "extensions.tech_vehiclePOI.collectVehiclePOIData('tech_adasUltrasonic.receivePOI')")
  be:queueObjectLua(vid, string.format("extensions.tech_adasUltrasonic.setup(%s, %s, %s)", tostring(parkAssist), tostring(blindSpots), tostring(args.hasCrawl == nil and true or args.hasCrawl)))
  be:queueObjectLua(vid, "extensions.tech_vehiclePOI.collectVehiclePOIData('tech_adasUltrasonic.receivePOI')")
  be:queueObjectLua(vid, string.format("extensions.tech_adasUltrasonic.setup(%s, %s, %s)", tostring(parkAssist), tostring(blindSpots), tostring(args.hasCrawl == nil and true or args.hasCrawl)))
  be:queueObjectLua(vid, "extensions.tech_vehiclePOI.collectVehiclePOIData('tech_adasUltrasonic.receivePOI')")
  be:queueObjectLua(vid, string.format("extensions.tech_adasUltrasonic.setup(%s, %s, %s)", tostring(parkAssist), tostring(blindSpots), tostring(args.hasCrawl == nil and true or args.hasCrawl)))
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/rallySuperCountdown.lua
  if self.data.useMessages then
    local msgStr = tostring(msg)
    -- Prefix numeric messages with "Countdown: "
@/lua/ge/extensions/gameplay/rally/recce/cutsRecording.lua

  log('I', logTag, 'loaded '..tostring(tscCount)..' transcripts')
  return transcripts

  log('I', logTag, 'loaded '..tostring(#cuts)..' cuts')
  return cuts
@/lua/ge/extensions/gameplay/rally/loop/speedingDetector.lua
  -- Current limit
  im.Text("Speed Limit: " .. tostring(self.currentLimitKph or "N/A") .. " kph")
@/lua/ge/extensions/gameplay/util/crashDetection.lua
          table.insert(vehicleList, vehId)
          vehicleListStr = vehicleListStr .. tostring(vehId) .. " (" .. vehJbeam .. ") | " .. crashData.owner .. "\0"
        end
      im.Dummy(im.ImVec2(1, 10))
      im.Text("Is crashing: " .. tostring(trackedVehIds[selectedVehId].isCrashing))
      im.Text("Is using vertically unweighted accel: " .. tostring(trackedVehIds[selectedVehId].crashSettings.verticallyUnweighted))
      im.Text("Is crashing: " .. tostring(trackedVehIds[selectedVehId].isCrashing))
      im.Text("Is using vertically unweighted accel: " .. tostring(trackedVehIds[selectedVehId].crashSettings.verticallyUnweighted))
    else
@/lua/common/csvlib.lua
    for i = 1, headercount do
      header[i] = #header[i] > 0 and tostring(header[i]):sub(1, 1) or "_"
    end
    elseif vtype == 'string' then
      v = tostring(v)
      local delimnum = self.delimnum
function csvWriter:dump()
  return tostring(self.buf)
end
@/lua/ge/extensions/util/saveDynamicData.lua
  local configCount = tableSize(filteredConfigs)
  log("I", logTag, tostring(configCount) .. " configs")
    local config = v.key
    log("I", logTag, tostring(progressCount) .. " / " .. tostring(configCount) .. ": " .. tostring(vehName) .. "->" .. tostring(config))
    local filepath = "vehicles/" .. vehName .. "/info_" .. config .. ".touched"
    local config = v.key
    log("I", logTag, tostring(progressCount) .. " / " .. tostring(configCount) .. ": " .. tostring(vehName) .. "->" .. tostring(config))
    local filepath = "vehicles/" .. vehName .. "/info_" .. config .. ".touched"
    local config = v.key
    log("I", logTag, tostring(progressCount) .. " / " .. tostring(configCount) .. ": " .. tostring(vehName) .. "->" .. tostring(config))
    local filepath = "vehicles/" .. vehName .. "/info_" .. config .. ".touched"
    local config = v.key
    log("I", logTag, tostring(progressCount) .. " / " .. tostring(configCount) .. ": " .. tostring(vehName) .. "->" .. tostring(config))
    local filepath = "vehicles/" .. vehName .. "/info_" .. config .. ".touched"
@/gameplay/tutorials/customNodes/carIdsNode.lua
    if car then
      self.pinOut["idCar"..tostring(i)].value = car.actualId
      self.pinOut["descCar"..tostring(i)].value = car.desc.description
      self.pinOut["idCar"..tostring(i)].value = car.actualId
      self.pinOut["descCar"..tostring(i)].value = car.desc.description
      self.pinOut["brandCar"..tostring(i)].value = car.desc.brand
      self.pinOut["descCar"..tostring(i)].value = car.desc.description
      self.pinOut["brandCar"..tostring(i)].value = car.desc.brand
      self.pinOut["modelCar"..tostring(i)].value = car.desc.model
      self.pinOut["brandCar"..tostring(i)].value = car.desc.brand
      self.pinOut["modelCar"..tostring(i)].value = car.desc.model
    end
@/lua/ge/extensions/core/settings/settings.lua
  values.uiLanguage = values.userLanguageSelected
  --print(' * userLanguageSelected: ' .. tostring(values.userLanguageSelected) .. ' [' .. tostring(values.userLanguageSelectedLong) .. ']')
  values.uiLanguage = values.userLanguageSelected
  --print(' * userLanguageSelected: ' .. tostring(values.userLanguageSelected) .. ' [' .. tostring(values.userLanguageSelectedLong) .. ']')
  values.languageOSLong = languageMap.resolve(values.languageOS)
  --print(' * languageOS: ' .. tostring(values.languageOS) .. ' [' .. tostring(values.languageOSLong) .. ']')
  values.languageProvider = Lua:getSteamLanguage()
  values.languageOSLong = languageMap.resolve(values.languageOS)
  --print(' * languageOS: ' .. tostring(values.languageOS) .. ' [' .. tostring(values.languageOSLong) .. ']')
  values.languageProvider = Lua:getSteamLanguage()
  values.languageProviderLong = OnlineServiceProvider and OnlineServiceProvider.language or ""
  --print(' * languageProvider: ' .. tostring(values.languageProvider) .. ' [' .. tostring(values.languageProviderLong) .. ']')
  values.languageProviderLong = OnlineServiceProvider and OnlineServiceProvider.language or ""
  --print(' * languageProvider: ' .. tostring(values.languageProvider) .. ' [' .. tostring(values.languageProviderLong) .. ']')
  appliedLanguage = Lua:getSelectedLanguage()
  --print(' - languageChanged >> ' .. tostring(languageChanged) .. ' | "' .. tostring(Lua:getSelectedLanguage()) .. '" ~= ' .. tostring(oldLanguage))
  appliedLanguage = Lua:getSelectedLanguage()
  --print(' - languageChanged >> ' .. tostring(languageChanged) .. ' | "' .. tostring(Lua:getSelectedLanguage()) .. '" ~= ' .. tostring(oldLanguage))
  appliedLanguage = Lua:getSelectedLanguage()
  --print(' - languageChanged >> ' .. tostring(languageChanged) .. ' | "' .. tostring(Lua:getSelectedLanguage()) .. '" ~= ' .. tostring(oldLanguage))
local function settingsTick(dtReal, dtSim, dtRaw)
  -- log('I','','settingsTick running... delayWriteTimer = '..tostring(delayWriteTimer)..'  dtReal = '..tostring(dtReal)..'  dtRaw = '..tostring(dtRaw))
  delayWriteTimer = delayWriteTimer - math.min(dtReal, 0.05) -- 20 fps = 0.05 sec
local function settingsTick(dtReal, dtSim, dtRaw)
  -- log('I','','settingsTick running... delayWriteTimer = '..tostring(delayWriteTimer)..'  dtReal = '..tostring(dtReal)..'  dtRaw = '..tostring(dtRaw))
  delayWriteTimer = delayWriteTimer - math.min(dtReal, 0.05) -- 20 fps = 0.05 sec
local function settingsTick(dtReal, dtSim, dtRaw)
  -- log('I','','settingsTick running... delayWriteTimer = '..tostring(delayWriteTimer)..'  dtReal = '..tostring(dtReal)..'  dtRaw = '..tostring(dtRaw))
  delayWriteTimer = delayWriteTimer - math.min(dtReal, 0.05) -- 20 fps = 0.05 sec

  -- log('I','settings','setValue called  key = '..tostring(key)..'  value = '..tostring(value))
  -- apply to memory right now

  -- log('I','settings','setValue called  key = '..tostring(key)..'  value = '..tostring(value))
  -- apply to memory right now
  local stateDirty = false
  if ignoreCache or values[key] == nil or (tostring(value) ~= tostring(values[key])) then
    stateDirty = true
  local stateDirty = false
  if ignoreCache or values[key] == nil or (tostring(value) ~= tostring(values[key])) then
    stateDirty = true
@/lua/common/jbeam/loader.lua
    if not vehicleObj then
      log('E', 'loader', 'unable to find object with it: ' .. tostring(objID))
    else
  --end
  --print(">>> spawnHash = " .. tostring(spawnHash))

  --log('D', 'loader', 'jbeam LOADING TOOK: ' .. tostring(t:stopAndReset()) .. ' ms')

  --log('D', 'loader', '3D LOADING TOOK: ' .. tostring(t:stopAndReset()) .. ' ms')
@/lua/ge/extensions/core/weather.lua
  if not p then
    log('E', 'weather', 'Weather preset not found: ' .. tostring(presetName))
    return
    if objs == nil then
      log('E', 'weather', 'object class not found: ' .. tostring(objClassStr))
      goto continue
  if not p then
    log('E', 'weather', 'Weather preset not found: ' .. tostring(presetName))
    return
    if type(objClassStr) ~= 'string' or type(attribTable) ~= 'table' then
      log('E', 'weather', 'object class or attrib table invalid: ' .. tostring(objClassStr))
      goto continue
    if objs == nil then
      log('E', 'weather', 'object class not found: ' .. tostring(objClassStr))
    else
          if type(fields[attrName]) ~= 'table' then
            log('E', 'weather', 'object attribute invalid: class = ' .. tostring(objClassStr) .. ', attribute = ' .. tostring(attrName))
            goto continue
          if type(fields[attrName]) ~= 'table' then
            log('E', 'weather', 'object attribute invalid: class = ' .. tostring(objClassStr) .. ', attribute = ' .. tostring(attrName))
            goto continue
          if val == nil then
            log('E', 'weather',  'invalid attribute: ' .. tostring(obj.name or '(no name)') .. ' [' .. objClassStr .. '].' .. tostring(attrName) .. ' = ' .. tostring(attrValue))
          else
          if val == nil then
            log('E', 'weather',  'invalid attribute: ' .. tostring(obj.name or '(no name)') .. ' [' .. objClassStr .. '].' .. tostring(attrName) .. ' = ' .. tostring(attrValue))
          else
          if val == nil then
            log('E', 'weather',  'invalid attribute: ' .. tostring(obj.name or '(no name)') .. ' [' .. objClassStr .. '].' .. tostring(attrName) .. ' = ' .. tostring(attrValue))
          else
          else
            log('D', 'weather',  ' * ' .. tostring(obj.name or '(no name)') .. ' [' .. objClassStr .. '].' .. tostring(attrName) .. ' = ' .. dumps(attrValue) .. ' / ' .. tostring(val))
            obj[attrName] = val
          else
            log('D', 'weather',  ' * ' .. tostring(obj.name or '(no name)') .. ' [' .. objClassStr .. '].' .. tostring(attrName) .. ' = ' .. dumps(attrValue) .. ' / ' .. tostring(val))
            obj[attrName] = val
          else
            log('D', 'weather',  ' * ' .. tostring(obj.name or '(no name)') .. ' [' .. objClassStr .. '].' .. tostring(attrName) .. ' = ' .. dumps(attrValue) .. ' / ' .. tostring(val))
            obj[attrName] = val
  local filePresets = jsonReadFile(filename)
  --log('D', 'weather', "Weather preset loaded: " .. tostring(filename) .. ": "..dumps(filePresets))
  if tableIsEmpty(filePresets) then
  if tableIsEmpty(filePresets) then
    log('E', 'weather', 'preset invalid: ' .. tostring(filename))
    return
  profilerPushEvent('loadWeather')
  --log('I', 'weather', "map loaded: " .. tostring(mission))
  loadPresets()
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/followWaypoints.lua
  builder:Middle()
  im.Text('State: ' .. tostring(self.durationState))
  if self.durationState ~= 'inactive' then
@/lua/ge/extensions/flowgraph/nodes/logic/sequencer.lua
  im.TextUnformatted(self.mode)
  im.TextUnformatted(tostring(modes[self.mode](self.index,self.count)) .. " ("..tostring(self.index)..")")
end
  im.TextUnformatted(self.mode)
  im.TextUnformatted(tostring(modes[self.mode](self.index,self.count)) .. " ("..tostring(self.index)..")")
end
@/lua/ge/extensions/editor/mainMenu.lua
  local str = ""
  if editor.editMode then str = tostring(editor.editMode.displayName or editor.editMode.iconTooltip or "Unknown") end
  imgui.TextColored(imgui.GetStyleColorVec4(imgui.Col_ButtonActive), str)
@/lua/ge/extensions/editor/dynamicDecals/fonts.lua
        for key = fontData.header.first_char, (fontData.header.first_char + fontData.header.glyph_count - 1) do
          local glyph = glyphs[tostring(key)]
          if glyph and glyph.exists == true then
          if glyph and glyph.exists == true then
            local char = glyphs[tostring(i)]
            im.ImageButton2(
          im.TableNextColumn()
          im.TextUnformatted(tostring(header.version))
          im.TableNextColumn()
          im.TextUnformatted(tostring(header.first_char))
          im.TableNextColumn()
          im.TextUnformatted(tostring(header.glyph_count))
            im.TableNextColumn()
            im.TextUnformatted(tostring(header.sdf.padding))
            im.TableNextColumn()
            im.TextUnformatted(tostring(header.sdf.onedge_value))
        for i = header.first_char, (header.first_char + header.glyph_count - 1), 1 do
          local char = glyphs[tostring(i)]
          im.ImageButton2(
        for i = header.first_char, (header.first_char + header.glyph_count - 1), 1 do
          local char = glyphs[tostring(i)]
          im.ImageButton2(
    if im.TreeNode1("Header##Font") then
      im.TextUnformatted("Version: " .. tostring(header["version"]))
      im.TextUnformatted("Font Name: " .. tostring(header["font_name"]))
      im.TextUnformatted("Version: " .. tostring(header["version"]))
      im.TextUnformatted("Font Name: " .. tostring(header["font_name"]))
      im.TextUnformatted("Atlas Width: " .. tostring(header["atlas_width"]))
      im.TextUnformatted("Font Name: " .. tostring(header["font_name"]))
      im.TextUnformatted("Atlas Width: " .. tostring(header["atlas_width"]))
      im.TextUnformatted("Atlas Height: " .. tostring(header["atlas_height"]))
      im.TextUnformatted("Atlas Width: " .. tostring(header["atlas_width"]))
      im.TextUnformatted("Atlas Height: " .. tostring(header["atlas_height"]))
      im.TextUnformatted("Glyph Pixel Height: " .. tostring(header["glyph_pixel_height"]))
      im.TextUnformatted("Atlas Height: " .. tostring(header["atlas_height"]))
      im.TextUnformatted("Glyph Pixel Height: " .. tostring(header["glyph_pixel_height"]))
      im.TextUnformatted("First Char Index: " .. tostring(header["first_char"]))
      im.TextUnformatted("Glyph Pixel Height: " .. tostring(header["glyph_pixel_height"]))
      im.TextUnformatted("First Char Index: " .. tostring(header["first_char"]))
      im.TextUnformatted("Glyph Count: " .. tostring(header["glyph_count"]))
      im.TextUnformatted("First Char Index: " .. tostring(header["first_char"]))
      im.TextUnformatted("Glyph Count: " .. tostring(header["glyph_count"]))
      im.TextUnformatted("Ascent: " .. tostring(header["ascent"]))
      im.TextUnformatted("Glyph Count: " .. tostring(header["glyph_count"]))
      im.TextUnformatted("Ascent: " .. tostring(header["ascent"]))
      im.TextUnformatted("Descent: " .. tostring(header["descent"]))
      im.TextUnformatted("Ascent: " .. tostring(header["ascent"]))
      im.TextUnformatted("Descent: " .. tostring(header["descent"]))
      im.TextUnformatted("Line Gap: " .. tostring(header["line_gap"]))
      im.TextUnformatted("Descent: " .. tostring(header["descent"]))
      im.TextUnformatted("Line Gap: " .. tostring(header["line_gap"]))
      im.Separator()

    local char = glyphs[tostring(header["first_char"] + selectedGlyphId)]
    local cpos = im.GetCursorPos()
    im.SetCursorPosX(textPosX)
    im.TextUnformatted("exists: " .. tostring(char["exists"]))
    im.SetCursorPosX(textPosX)
    im.SetCursorPosX(textPosX)
    im.TextUnformatted("monospaced_x: " .. tostring(char["monospaced_x"]))
    im.SetCursorPosX(textPosX)
    im.SetCursorPosX(textPosX)
    im.TextUnformatted("monospaced_y: " .. tostring(char["monospaced_y"]))
    -- im.SetCursorPosX(textPosX)
    -- im.SetCursorPosX(textPosX)
    -- im.TextUnformatted("x0: " .. tostring(char["x0"]))
    -- im.SetCursorPosX(textPosX)
    -- im.SetCursorPosX(textPosX)
    -- im.TextUnformatted("y0: " .. tostring(char["y0"]))
    -- im.SetCursorPosX(textPosX)
    -- im.SetCursorPosX(textPosX)
    -- im.TextUnformatted("x1: " .. tostring(char["x1"]))
    -- im.SetCursorPosX(textPosX)
    -- im.SetCursorPosX(textPosX)
    -- im.TextUnformatted("y1: " .. tostring(char["y1"]))
    -- im.SetCursorPosX(textPosX)
    -- im.SetCursorPosX(textPosX)
    -- im.TextUnformatted("width: " .. tostring(char["width"]))
    -- im.SetCursorPosX(textPosX)
    -- im.SetCursorPosX(textPosX)
    -- im.TextUnformatted("height: " .. tostring(char["height"]))
    im.SetCursorPosX(textPosX)
    im.SetCursorPosX(textPosX)
    im.TextUnformatted("xoff: " .. tostring(char["xoff"]))
    im.SetCursorPosX(textPosX)
    im.SetCursorPosX(textPosX)
    im.TextUnformatted("yoff: " .. tostring(char["yoff"]))
    im.SetCursorPosX(textPosX)
    im.SetCursorPosX(textPosX)
    im.TextUnformatted("xadvance: " .. tostring(char["xadvance"]))
    local afterTextPos = im.GetCursorPos()
@/lua/common/testFramework/TestManager.lua
      else
        log('E', '', 'Unknown test function: ' .. tostring(name))
        if not name:match("^test") then
        if not name:match("^test") then
          log('E', '', 'Function name must begin with \'test\', rename the function to \'test' .. tostring(name) .. '\'.')
        end
        else
          log('E', '', ' - ' .. displayName .. " >>> FAILED: " .. tostring(err))
        end

    log('I', '', "Test PASS count: " .. tostring(self.__internal.testPassCount))
    if self.__internal.testFailCount > 0 then
    if self.__internal.testFailCount > 0 then
      log('I', '', "Test FAIL count: " .. tostring(self.__internal.testFailCount))
    end
@/lua/common/libs/lunajson/lunajson/sax.lua
  -- deal with non-standard locales
  local radixmark = match(tostring(0.5), '[^0-9]')
  local fixedtonumber = tonumber
@/lua/ge/extensions/core/quickAccess.lua
  end
  return tostring(a._key) < tostring(b._key)
end
  end
  return tostring(a._key) < tostring(b._key)
end
  if vehicle and getVehicleItems then
    vehicle:queueLuaCommand('extensions.core_quickAccess.requestItems("' .. tostring(currentLevel) .. '")')
    -- we give the vehicle 4 gfx frames to add items
    if not veh then
      log('E', 'quickaccess', 'unable to select item. vehicle got missing: ' .. tostring(objID) .. ' - menu item: ' .. dumps(item))
      return
  if m == nil then
    log('E', 'quickAccess.selectItem', 'item not found: ' .. tostring(id))
  end
  if m == nil then
    log('E', 'quickAccess.contextAction', 'item not found: ' .. tostring(id))
  end
local function vehicleItemSelectCallback(objID, args)
  log('D', 'quickAccess.vehicleItemSelectCallback', 'got result from id: ' .. tostring(objID) .. ' : ' .. dumps(args))
  --we don't need objID for now
@/gameplay/tutorials/customNodes/registerTestCarsNode.lua
  for i = 1, 6, 1 do
    self.mgr._fgTutoTestCarsStep.carsData[self.pinIn["idCar" .. tostring(i)].value] = 
    {
      id = i,
      actualId = self.pinIn["idCar" .. tostring(i)].value,
      desc = {
      desc = {
        brand = self.pinIn["brandCar" .. tostring(i)].value,
        model = self.pinIn["modelCar" .. tostring(i)].value,
        brand = self.pinIn["brandCar" .. tostring(i)].value,
        model = self.pinIn["modelCar" .. tostring(i)].value,
        description = self.pinIn["descCar" .. tostring(i)].value,
        model = self.pinIn["modelCar" .. tostring(i)].value,
        description = self.pinIn["descCar" .. tostring(i)].value,
        gearBox = i < 4 and "M" or "A",
        gearBox = i < 4 and "M" or "A",
        price = self.pinIn["priceCar" .. tostring(i)].value,
      }
@/lua/ge/extensions/flowgraph/variableStorage.lua
  else
    --log('E', '', 'Invalid Merge function! ' .. tostring(strat))
    local default = "last"
  if type == 'string' then
    self.variables[name].baseValue = tostring(self.variables[name].baseValue) or ""
    self.variables[name].value = tostring(self.variables[name].value) or ""
    self.variables[name].baseValue = tostring(self.variables[name].baseValue) or ""
    self.variables[name].value = tostring(self.variables[name].value) or ""
  elseif type == 'bool' then
@/lua/vehicle/htmlTexture.lua
local function callJS(self, jsMethod, data)
  --print('call(' .. tostring(self.webViewTag) .. ',' .. tostring(jsMethod) .. ',' .. dumps(data) .. ')')
  obj:queueWebViewJS(self.webViewTag, string.format("%s(%s)", jsMethod, jsonEncode(data)))
local function callJS(self, jsMethod, data)
  --print('call(' .. tostring(self.webViewTag) .. ',' .. tostring(jsMethod) .. ',' .. dumps(data) .. ')')
  obj:queueWebViewJS(self.webViewTag, string.format("%s(%s)", jsMethod, jsonEncode(data)))
local function streamJS(self, streamName, jsMethod, data)
  --print('call(' .. tostring(self.webViewTag) .. ',' .. tostring(jsMethod) .. ',' .. dumps(data) .. ')')
  obj:queueWebViewStreamJS(self.webViewTag, streamName, string.format("%s(%s)", jsMethod, jsonEncode(data)))
local function streamJS(self, streamName, jsMethod, data)
  --print('call(' .. tostring(self.webViewTag) .. ',' .. tostring(jsMethod) .. ',' .. dumps(data) .. ')')
  obj:queueWebViewStreamJS(self.webViewTag, streamName, string.format("%s(%s)", jsMethod, jsonEncode(data)))
local function call(webViewTag, jsMethod, data)
  --print('call(' .. tostring(webViewTag) .. ',' .. tostring(jsMethod) .. ',' .. dumps(data) .. ')')
  local jsCmd = string.format("%s(%s)", jsMethod, jsonEncode(data))
local function call(webViewTag, jsMethod, data)
  --print('call(' .. tostring(webViewTag) .. ',' .. tostring(jsMethod) .. ',' .. dumps(data) .. ')')
  local jsCmd = string.format("%s(%s)", jsMethod, jsonEncode(data))
local function create(webViewTag, uri, width, height, fps, usagemode)
  --print('create(' .. tostring(webViewTag) .. ',' .. tostring(uri) .. ',' .. tostring(width) .. ',' .. tostring(height) .. ',' .. tostring(fps) .. ',' .. tostring(usagemode) .. ')')
  local usageModeID = 0
local function create(webViewTag, uri, width, height, fps, usagemode)
  --print('create(' .. tostring(webViewTag) .. ',' .. tostring(uri) .. ',' .. tostring(width) .. ',' .. tostring(height) .. ',' .. tostring(fps) .. ',' .. tostring(usagemode) .. ')')
  local usageModeID = 0
local function create(webViewTag, uri, width, height, fps, usagemode)
  --print('create(' .. tostring(webViewTag) .. ',' .. tostring(uri) .. ',' .. tostring(width) .. ',' .. tostring(height) .. ',' .. tostring(fps) .. ',' .. tostring(usagemode) .. ')')
  local usageModeID = 0
local function create(webViewTag, uri, width, height, fps, usagemode)
  --print('create(' .. tostring(webViewTag) .. ',' .. tostring(uri) .. ',' .. tostring(width) .. ',' .. tostring(height) .. ',' .. tostring(fps) .. ',' .. tostring(usagemode) .. ')')
  local usageModeID = 0
local function create(webViewTag, uri, width, height, fps, usagemode)
  --print('create(' .. tostring(webViewTag) .. ',' .. tostring(uri) .. ',' .. tostring(width) .. ',' .. tostring(height) .. ',' .. tostring(fps) .. ',' .. tostring(usagemode) .. ')')
  local usageModeID = 0
local function create(webViewTag, uri, width, height, fps, usagemode)
  --print('create(' .. tostring(webViewTag) .. ',' .. tostring(uri) .. ',' .. tostring(width) .. ',' .. tostring(height) .. ',' .. tostring(fps) .. ',' .. tostring(usagemode) .. ')')
  local usageModeID = 0
@/lua/ge/extensions/editor/rallyEditor/measurementsTab.lua

    data.measurements[tostring(id)] = {
      id = measurement.id,
  self.selectedPointIndex = nil
  log('D', logTag, 'Selected measurement: ' .. tostring(measurementId))
end
        self:addPointToMeasurement(self.selectedMeasurementId, continuousPos)
        log('D', logTag, 'Added measurement point at: ' .. tostring(continuousPos))
      else
        self:saveMeasurements()  -- auto-save
        log('D', logTag, 'Follow Route set to: ' .. tostring(selectedMeasurement.followRoute))
      end
@/lua/ge/extensions/flowgraph/nodes/types/bool.lua
  builder:Middle()
  im.TextUnformatted(tostring(self.data.value))
end
@/lua/ge/extensions/editor/gen/top.lua
local function chop(base)
--        U.dump(base, '>> cut:'..tostring(#base), true)
	for i = 1,#base do
		local v = U.mod(i+1,base) - base[i]
--                lo('?? for_ang:'..i..':'..tostring(u)..':'..tostring(v), true)
		if u:cross(v).z < 0 then
		local v = U.mod(i+1,base) - base[i]
--                lo('?? for_ang:'..i..':'..tostring(u)..':'..tostring(v), true)
		if u:cross(v).z < 0 then
		end
--            lo('?? for_ang:'..i..':'..tostring(ang)..':'..tostring(a)..':'..tostring(b))
	end
		end
--            lo('?? for_ang:'..i..':'..tostring(ang)..':'..tostring(a)..':'..tostring(b))
	end
		end
--            lo('?? for_ang:'..i..':'..tostring(ang)..':'..tostring(a)..':'..tostring(b))
	end
--                if j == 8 then
--                    lo('?? pU_j:'..U.mod(j,#base)..' d:'..d..'/'..tostring(dmi)..' ang:'..tostring(ang))
--                end
--                if j == 8 then
--                    lo('?? pU_j:'..U.mod(j,#base)..' d:'..d..'/'..tostring(dmi)..' ang:'..tostring(ang))
--                end
			if d < dmi and ang < 10*small_ang then
--                    lo('?? pU_j:'..U.mod(j,#base)..' d:'..d..'/'..tostring(dmi)..' ang:'..tostring(ang)) --..':'..tostring(u)..':'..tostring(v)..':'..tostring(U.vang(u,v))..':'..tostring(u:dot(v)/u:length()/v:length())..':'..tostring(math.acos(u:dot(v)/u:length()/v:length())))
				local cmi = {U.mod(i+ishift,#base),U.mod(j,#base)}
			if d < dmi and ang < 10*small_ang then
--                    lo('?? pU_j:'..U.mod(j,#base)..' d:'..d..'/'..tostring(dmi)..' ang:'..tostring(ang)) --..':'..tostring(u)..':'..tostring(v)..':'..tostring(U.vang(u,v))..':'..tostring(u:dot(v)/u:length()/v:length())..':'..tostring(math.acos(u:dot(v)/u:length()/v:length())))
				local cmi = {U.mod(i+ishift,#base),U.mod(j,#base)}
			if d < dmi and ang < 10*small_ang then
--                    lo('?? pU_j:'..U.mod(j,#base)..' d:'..d..'/'..tostring(dmi)..' ang:'..tostring(ang)) --..':'..tostring(u)..':'..tostring(v)..':'..tostring(U.vang(u,v))..':'..tostring(u:dot(v)/u:length()/v:length())..':'..tostring(math.acos(u:dot(v)/u:length()/v:length())))
				local cmi = {U.mod(i+ishift,#base),U.mod(j,#base)}
			if d < dmi and ang < 10*small_ang then
--                    lo('?? pU_j:'..U.mod(j,#base)..' d:'..d..'/'..tostring(dmi)..' ang:'..tostring(ang)) --..':'..tostring(u)..':'..tostring(v)..':'..tostring(U.vang(u,v))..':'..tostring(u:dot(v)/u:length()/v:length())..':'..tostring(math.acos(u:dot(v)/u:length()/v:length())))
				local cmi = {U.mod(i+ishift,#base),U.mod(j,#base)}
			if d < dmi and ang < 10*small_ang then
--                    lo('?? pU_j:'..U.mod(j,#base)..' d:'..d..'/'..tostring(dmi)..' ang:'..tostring(ang)) --..':'..tostring(u)..':'..tostring(v)..':'..tostring(U.vang(u,v))..':'..tostring(u:dot(v)/u:length()/v:length())..':'..tostring(math.acos(u:dot(v)/u:length()/v:length())))
				local cmi = {U.mod(i+ishift,#base),U.mod(j,#base)}
			if d < dmi and ang < 10*small_ang then
--                    lo('?? pU_j:'..U.mod(j,#base)..' d:'..d..'/'..tostring(dmi)..' ang:'..tostring(ang)) --..':'..tostring(u)..':'..tostring(v)..':'..tostring(U.vang(u,v))..':'..tostring(u:dot(v)/u:length()/v:length())..':'..tostring(math.acos(u:dot(v)/u:length()/v:length())))
				local cmi = {U.mod(i+ishift,#base),U.mod(j,#base)}
			if d < dmi and ang < 10*small_ang then
--                    lo('?? pU_j:'..U.mod(j,#base)..' d:'..d..'/'..tostring(dmi)..' ang:'..tostring(ang)) --..':'..tostring(u)..':'..tostring(v)..':'..tostring(U.vang(u,v))..':'..tostring(u:dot(v)/u:length()/v:length())..':'..tostring(math.acos(u:dot(v)/u:length()/v:length())))
				local cmi = {U.mod(i+ishift,#base),U.mod(j,#base)}
				local z = v1:cross(v2).z
--                    U.dump(cmi,'?? to_check:'..z..':'..tostring(v1)..':'..tostring(v2))
				if z < 0 then
				local z = v1:cross(v2).z
--                    U.dump(cmi,'?? to_check:'..z..':'..tostring(v1)..':'..tostring(v2))
				if z < 0 then
		end
--            lo('?? pairsUp:'..i..' imi:'..tostring(imi and imi[1] or nil)..':'..tostring(imi and imi[2] or nil))
		if imi then
		end
--            lo('?? pairsUp:'..i..' imi:'..tostring(imi and imi[1] or nil)..':'..tostring(imi and imi[2] or nil))
		if imi then
--        W.out.avedit = {vcross}
--        lo('?? for_cross:'..tostring(x)..':'..tostring(y))
	-- cross middle thin with thick plate
--        W.out.avedit = {vcross}
--        lo('?? for_cross:'..tostring(x)..':'..tostring(y))
	-- cross middle thin with thick plate
		if dbg then
			U.dump(base, '?? forGable:'..tostring(apair))
		end
--                local ang = U.vang(U.mod(4+1,base) - base[4],base[4] - U.mod(4-1,base),false,true)
				lo('!! ERR_forGable_MULT:'..tostring(apair)..':'..#base..':'..#U.polyStraighten(base)) --..':'..ang, true)
--                U.dump(base)
]]
--        U.dump(apair, '>> forGable:'..#base..':'..tostring(apair))
	local function meshClose(pair, ap, aroof)
--            U.dump(pair, '?? meshClose:'..tostring(ap and #ap or nil))
		if not ap then return end
		if not ap then return end
--            lo('?? for_p:'..tostring(pair[1]))
		ap[#ap+1] = U.mod(pair[1]+1,base)
				local winv,ainv
	--                lo('?? a1:'..tostring(c[1])..' b:'..tostring(b[1])..' c:'..tostring(a[1]))
	--                lo('?? for_ang:'..ang..':'..U.vang(a[1]-b[1], b[1]-c[1], true))
				local winv,ainv
	--                lo('?? a1:'..tostring(c[1])..' b:'..tostring(b[1])..' c:'..tostring(a[1]))
	--                lo('?? for_ang:'..ang..':'..U.vang(a[1]-b[1], b[1]-c[1], true))
				local winv,ainv
	--                lo('?? a1:'..tostring(c[1])..' b:'..tostring(b[1])..' c:'..tostring(a[1]))
	--                lo('?? for_ang:'..ang..':'..U.vang(a[1]-b[1], b[1]-c[1], true))
					c = {c[2],c[1]}
	--                    lo('?? a2:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
	--                    lo('?? new_ANG:'..U.vang(b[1]-a[1], c[1]-b[1], true))
					c = {c[2],c[1]}
	--                    lo('?? a2:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
	--                    lo('?? new_ANG:'..U.vang(b[1]-a[1], c[1]-b[1], true))
					c = {c[2],c[1]}
	--                    lo('?? a2:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
	--                    lo('?? new_ANG:'..U.vang(b[1]-a[1], c[1]-b[1], true))
				end
--                    lo('?? inv: w:'..i..':'..tostring(winv)..' a:'..tostring(ainv)..':'..(d/D)..':'..d..':'..D..':'..tostring(a[2])..':'..tostring(a[1])..':'..tostring(b[1]))
	--                lo('?? a:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
				end
--                    lo('?? inv: w:'..i..':'..tostring(winv)..' a:'..tostring(ainv)..':'..(d/D)..':'..d..':'..D..':'..tostring(a[2])..':'..tostring(a[1])..':'..tostring(b[1]))
	--                lo('?? a:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
				end
--                    lo('?? inv: w:'..i..':'..tostring(winv)..' a:'..tostring(ainv)..':'..(d/D)..':'..d..':'..D..':'..tostring(a[2])..':'..tostring(a[1])..':'..tostring(b[1]))
	--                lo('?? a:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
				end
--                    lo('?? inv: w:'..i..':'..tostring(winv)..' a:'..tostring(ainv)..':'..(d/D)..':'..d..':'..D..':'..tostring(a[2])..':'..tostring(a[1])..':'..tostring(b[1]))
	--                lo('?? a:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
				end
--                    lo('?? inv: w:'..i..':'..tostring(winv)..' a:'..tostring(ainv)..':'..(d/D)..':'..d..':'..D..':'..tostring(a[2])..':'..tostring(a[1])..':'..tostring(b[1]))
	--                lo('?? a:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
--                    lo('?? inv: w:'..i..':'..tostring(winv)..' a:'..tostring(ainv)..':'..(d/D)..':'..d..':'..D..':'..tostring(a[2])..':'..tostring(a[1])..':'..tostring(b[1]))
	--                lo('?? a:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
	--                lo('?? for_turn:'..U.vang(b[1]-a[1], c[1]-b[1], true))
--                    lo('?? inv: w:'..i..':'..tostring(winv)..' a:'..tostring(ainv)..':'..(d/D)..':'..d..':'..D..':'..tostring(a[2])..':'..tostring(a[1])..':'..tostring(b[1]))
	--                lo('?? a:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
	--                lo('?? for_turn:'..U.vang(b[1]-a[1], c[1]-b[1], true))
--                    lo('?? inv: w:'..i..':'..tostring(winv)..' a:'..tostring(ainv)..':'..(d/D)..':'..d..':'..D..':'..tostring(a[2])..':'..tostring(a[1])..':'..tostring(b[1]))
	--                lo('?? a:'..tostring(a[1])..' b:'..tostring(b[1])..' c:'..tostring(c[1]))
	--                lo('?? for_turn:'..U.vang(b[1]-a[1], c[1]-b[1], true))
				local ap,aP = stick(a,b,c, winv and D/d or d/D)
	--                lo('?? if_INV:'..tostring(winv)..':'..tostring(ainv))
	--                W.out.avedit = ap
				local ap,aP = stick(a,b,c, winv and D/d or d/D)
	--                lo('?? if_INV:'..tostring(winv)..':'..tostring(ainv))
	--                W.out.avedit = ap

--        U.dump(av, '?? forGable.for_av2:'..tostring(av and #av or nil))
	if not av then return {} end
			local d2 = U.toLine(U.mod(i+1,base), {U.mod(#base-i-1,base),U.mod(#base-i,base)})
				lo('?? for_D:'..i..':'..tostring(d1)..':'..tostring(d2)..':'..tostring(U.mod(i,base))..':'..tostring(U.mod(i+1,base)))
			if d1
			local d2 = U.toLine(U.mod(i+1,base), {U.mod(#base-i-1,base),U.mod(#base-i,base)})
				lo('?? for_D:'..i..':'..tostring(d1)..':'..tostring(d2)..':'..tostring(U.mod(i,base))..':'..tostring(U.mod(i+1,base)))
			if d1
			local d2 = U.toLine(U.mod(i+1,base), {U.mod(#base-i-1,base),U.mod(#base-i,base)})
				lo('?? for_D:'..i..':'..tostring(d1)..':'..tostring(d2)..':'..tostring(U.mod(i,base))..':'..tostring(U.mod(i+1,base)))
			if d1
			local d2 = U.toLine(U.mod(i+1,base), {U.mod(#base-i-1,base),U.mod(#base-i,base)})
				lo('?? for_D:'..i..':'..tostring(d1)..':'..tostring(d2)..':'..tostring(U.mod(i,base))..':'..tostring(U.mod(i+1,base)))
			if d1
	base = U.polyStraighten(base)
		  lo('>>++++++++ forRidge:'..tostring(ichild)..':'..tostring(ishift)..':'..tostring(floor.top.margin)..':'..tostring(base[1]),true)
	base = U.polyStraighten(base)
		  lo('>>++++++++ forRidge:'..tostring(ichild)..':'..tostring(ishift)..':'..tostring(floor.top.margin)..':'..tostring(base[1]),true)
	base = U.polyStraighten(base)
		  lo('>>++++++++ forRidge:'..tostring(ichild)..':'..tostring(ishift)..':'..tostring(floor.top.margin)..':'..tostring(base[1]),true)
	base = U.polyStraighten(base)
		  lo('>>++++++++ forRidge:'..tostring(ichild)..':'..tostring(ishift)..':'..tostring(floor.top.margin)..':'..tostring(base[1]),true)
]]
--        U.dump(base, '>> forRidge:'..tostring(floor)..':'..(floor and floor.top.margin or 'NONE')..':'..tostring(flat)..':'..tostring(W))
	if #base ~= 4 then flat = false end
]]
--        U.dump(base, '>> forRidge:'..tostring(floor)..':'..(floor and floor.top.margin or 'NONE')..':'..tostring(flat)..':'..tostring(W))
	if #base ~= 4 then flat = false end
]]
--        U.dump(base, '>> forRidge:'..tostring(floor)..':'..(floor and floor.top.margin or 'NONE')..':'..tostring(flat)..':'..tostring(W))
	if #base ~= 4 then flat = false end
--        U.dump(amult, '?? fR.for_MULT:')
--        U.dump(apair, '?? fR.forRidge.apair:'..tostring(floor))
	--TODO: order pairs
--    for i = 1,#base do
--            U.dump(apair[cpair],'?? for_I:'..i..':'..cpair..':'..tostring(indown), true)
		if indown then
			local v = U.mod(j+1,base) - base[j]
--                lo('?? for_uv:'..i..':'..j..':'..tostring(u)..':'..tostring(v), true)
			if math.abs(U.vang(u,v)-math.pi) < 10*small_ang then
			local v = U.mod(j+1,base) - base[j]
--                lo('?? for_uv:'..i..':'..j..':'..tostring(u)..':'..tostring(v), true)
			if math.abs(U.vang(u,v)-math.pi) < 10*small_ang then
]]
--            lo('?? cc:'..tostring(c1)..':'..tostring(c2)..':'..p[1]..':'..p[2], true)
--            lo('?? ffff:'..tostring(f1)..':'..tostring(f2)..':'..tostring(f3)..':'..tostring(f4), true)
]]
--            lo('?? cc:'..tostring(c1)..':'..tostring(c2)..':'..p[1]..':'..p[2], true)
--            lo('?? ffff:'..tostring(f1)..':'..tostring(f2)..':'..tostring(f3)..':'..tostring(f4), true)
--            lo('?? cc:'..tostring(c1)..':'..tostring(c2)..':'..p[1]..':'..p[2], true)
--            lo('?? ffff:'..tostring(f1)..':'..tostring(f2)..':'..tostring(f3)..':'..tostring(f4), true)
--            lo('?? cc:'..tostring(c1)..':'..tostring(c2)..':'..p[1]..':'..p[2], true)
--            lo('?? ffff:'..tostring(f1)..':'..tostring(f2)..':'..tostring(f3)..':'..tostring(f4), true)
--            lo('?? cc:'..tostring(c1)..':'..tostring(c2)..':'..p[1]..':'..p[2], true)
--            lo('?? ffff:'..tostring(f1)..':'..tostring(f2)..':'..tostring(f3)..':'..tostring(f4), true)
--            lo('?? cc:'..tostring(c1)..':'..tostring(c2)..':'..p[1]..':'..p[2], true)
--            lo('?? ffff:'..tostring(f1)..':'..tostring(f2)..':'..tostring(f3)..':'..tostring(f4), true)
--            W.out.aforest[#W.out.aforest+1] = W.forDesc() and (W.base2world(W.forDesc(), {3, 1}, c2) + vec3(0,0,8)) or nil
--                lo('?? sF:'..tostring(c1)..':'..tostring(c2), true)
--            W.out.aforest[#W.out.aforest+1] = W.forDesc() and (W.base2world(W.forDesc(), {3, 1}, c2) + vec3(0,0,8)) or nil
--                lo('?? sF:'..tostring(c1)..':'..tostring(c2), true)
	}
--            lo('?? forRidge.for_AV:'..tostring(floor)..':'..#av..':'..#af..':'..#floor.top.achild..':'..#achild..':'..tostring(flat),true)
	-- add noridge children
	}
--            lo('?? forRidge.for_AV:'..tostring(floor)..':'..#av..':'..#af..':'..#floor.top.achild..':'..#achild..':'..tostring(flat),true)
	-- add noridge children
				c.shape = floor.top.achild[i].shape
--                    lo('?? fR_param_:'..i..':'..tostring(c.id),true)
			end
		end
--            U.dump(achild, '?? fR.achild:'..tostring(flat))
		floor.top.achild = achild
	--                        if i == 6 then
								U.dump(ps, '?? for61:'..tostring(ps[1]
	--                        if i == 6 then
								U.dump(ps, '?? for61:'..tostring(ps[1]
			local p = apair[k]
	--            lo('?? for_PAIR: k='..k..':'..p[1]..':'..p[2]..':'..tostring(apair[k+1][1]-1)..':'..tostring(apair[k+1][2]+1), true)
			if p[1] == apair[k+1][1]-1 and p[2] == apair[k+1][2]+1 then
			local p = apair[k]
	--            lo('?? for_PAIR: k='..k..':'..p[1]..':'..p[2]..':'..tostring(apair[k+1][1]-1)..':'..tostring(apair[k+1][2]+1), true)
			if p[1] == apair[k+1][1]-1 and p[2] == apair[k+1][2]+1 then
@/lua/ge/extensions/editor/buildingEditor.lua
local function reload(mode, soft)
		UU.lo('?? bE.reload:'..tostring(mode)..':'..tostring(soft),true)
	if W ~= nil and not soft then
local function reload(mode, soft)
		UU.lo('?? bE.reload:'..tostring(mode)..':'..tostring(soft),true)
	if W ~= nil and not soft then
	end
	local s = tostring(list[1])
	for o = 2,#list do
		if dbg and pi * pip < 0 then
			lo('??___<:'..i..'/'..start..':'..tostring(p)..':'..tostring(ni)..':'..tostring(nip)..':'..p:distanceToLineSegment(ni, nip))
			local api = math.abs(pi) --/(p - ni):length()/(nip - ni):length()
		if dbg and pi * pip < 0 then
			lo('??___<:'..i..'/'..start..':'..tostring(p)..':'..tostring(ni)..':'..tostring(nip)..':'..p:distanceToLineSegment(ni, nip))
			local api = math.abs(pi) --/(p - ni):length()/(nip - ni):length()
		if dbg and pi * pip < 0 then
			lo('??___<:'..i..'/'..start..':'..tostring(p)..':'..tostring(ni)..':'..tostring(nip)..':'..p:distanceToLineSegment(ni, nip))
			local api = math.abs(pi) --/(p - ni):length()/(nip - ni):length()
  if true then return end
--    lo('?? dump:'..tostring(lvl)..':'..type(t))
	if type(t) == 'table' then
		for o,e in pairs(t) do
--            lo(type(o)..':'..type(e)..':'..o..':'..tostring(e))
			local lt = U.dump(e, nil, 1)
	else
--        lo('?? dump_nn:'..type(t)..':'..tostring(t))
		return tostring(t)
--        lo('?? dump_nn:'..type(t)..':'..tostring(t))
		return tostring(t)
	end
		toLineBuf(v, v + dv, (i-1)*6)
--        lo('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
		toLineBuf(v, v + dv, (i-1)*6)
--        lo('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
		toLineBuf(v, v + dv, (i-1)*6)
--        lo('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
		toLineBuf(v, v + dv, (i-1)*6)
--        lo('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
		toLineBuf(v, v + dv, (i-1)*6)
--        lo('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
		toLineBuf(v, v + dv, (i-1)*6)
--        lo('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
Mesh.rect = function(u, v, av, af)
--    lo('?? rect:'..tostring(u)..':'..tostring(v))
	av[#av + 1] = vec3(0, 0, 0)
Mesh.rect = function(u, v, av, af)
--    lo('?? rect:'..tostring(u)..':'..tostring(v))
	av[#av + 1] = vec3(0, 0, 0)
		end
--        lo('?? for_ang:'..tostring(v:normalized())..':'..aang[#aang][2])
	end
	for i = 1,#path do
--        lo('?? for_node:'..i..':'..path[i]..'<'..tostring(path[i - 1]))
		local h = 0
		if nc == path[i - 1] and (nb == path[i] or ne == path[i]) then
--            lo('??==== obt1: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
			tounfold = true
		if nc == path[i - 1] and (nb == path[i] or ne == path[i]) then
--            lo('??==== obt1: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
			tounfold = true
		if nc == path[i - 1] and (nb == path[i] or ne == path[i]) then
--            lo('??==== obt1: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
			tounfold = true
		if nc == path[i] and (nb == path[i - 1] or ne == path[i - 1]) then
--            lo('??==== obt2: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
			tounfold = true
		if nc == path[i] and (nb == path[i - 1] or ne == path[i - 1]) then
--            lo('??==== obt2: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
			tounfold = true
		if nc == path[i] and (nb == path[i - 1] or ne == path[i - 1]) then
--            lo('??==== obt2: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
			tounfold = true
local function av2hmap(dec, list, dbg)
--            lo('>> av2hmap:'..tostring(dbg))
	local hmap, apin = {}, {}
				end
--                lo('?? av2hmap:'..ind..':'..tostring(dec:getMiddleEdgePosition(ind))..':'..ei)
			local h = U.hightOnCurve(dec:getMiddleEdgePosition(ind), rdinfo, ei, dbg)
			else
				lo('!! av2hmap.NO_H:'..ind..':'..tostring(dbg))
			end
				if dbg then
					lo('?? forOut:'..i..':'..d..':'..tostring(dp))
				end
		for _,dir in pairs {1, -1} do
					lo('?? for_dir:'..dir..':'..s[2]..':'..tostring(decal:getEdgeCount())..':'..tostring(decal:getMiddleEdgePosition(s[2]))) --..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2] + dir))..':'..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2])))
			adir[#adir + 1] =
		for _,dir in pairs {1, -1} do
					lo('?? for_dir:'..dir..':'..s[2]..':'..tostring(decal:getEdgeCount())..':'..tostring(decal:getMiddleEdgePosition(s[2]))) --..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2] + dir))..':'..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2])))
			adir[#adir + 1] =
		for _,dir in pairs {1, -1} do
					lo('?? for_dir:'..dir..':'..s[2]..':'..tostring(decal:getEdgeCount())..':'..tostring(decal:getMiddleEdgePosition(s[2]))) --..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2] + dir))..':'..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2])))
			adir[#adir + 1] =
		for _,dir in pairs {1, -1} do
					lo('?? for_dir:'..dir..':'..s[2]..':'..tostring(decal:getEdgeCount())..':'..tostring(decal:getMiddleEdgePosition(s[2]))) --..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2] + dir))..':'..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2])))
			adir[#adir + 1] =
		local inpath = U.index(r.path, icirc)
				U.dump(inpath,'?? inpath:'..icirc..':'..tostring(cpos)..' rid:'..tostring(r.id))
		local indec = {}
		local inpath = U.index(r.path, icirc)
				U.dump(inpath,'?? inpath:'..icirc..':'..tostring(cpos)..' rid:'..tostring(r.id))
		local indec = {}
				U.dump(inedge[i], '?? junctionUp_inedge:'..i)
				lo('?? edge_0:'..tostring(r.av[1])..':'..tostring(r.av[r.avstep])..':'..tostring(decal:getMiddleEdgePosition(0)))
		--- exits positions
				U.dump(inedge[i], '?? junctionUp_inedge:'..i)
				lo('?? edge_0:'..tostring(r.av[1])..':'..tostring(r.av[r.avstep])..':'..tostring(decal:getMiddleEdgePosition(0)))
		--- exits positions
				U.dump(inedge[i], '?? junctionUp_inedge:'..i)
				lo('?? edge_0:'..tostring(r.av[1])..':'..tostring(r.av[r.avstep])..':'..tostring(decal:getMiddleEdgePosition(0)))
		--- exits positions
			lo('?? for_edge:'..e..':'
			..tostring(r.av[e*step+1])..':'..tostring(r.av[e*step + r.avstep])..':'
			..tostring(decal:getMiddleEdgePosition(e)))
			lo('?? for_edge:'..e..':'
			..tostring(r.av[e*step+1])..':'..tostring(r.av[e*step + r.avstep])..':'
			..tostring(decal:getMiddleEdgePosition(e)))
			..tostring(r.av[e*step+1])..':'..tostring(r.av[e*step + r.avstep])..':'
			..tostring(decal:getMiddleEdgePosition(e)))
--            lo('?? for_edge:'..tostring(r.av[0])..':'..tostring(r.av[r.avstep-1])..':'..tostring(r.av[lv]))
			..tostring(decal:getMiddleEdgePosition(e)))
--            lo('?? for_edge:'..tostring(r.av[0])..':'..tostring(r.av[r.avstep-1])..':'..tostring(r.av[lv]))
			for j = e + 1,#av/step do
			..tostring(decal:getMiddleEdgePosition(e)))
--            lo('?? for_edge:'..tostring(r.av[0])..':'..tostring(r.av[r.avstep-1])..':'..tostring(r.av[lv]))
			for j = e + 1,#av/step do
			..tostring(decal:getMiddleEdgePosition(e)))
--            lo('?? for_edge:'..tostring(r.av[0])..':'..tostring(r.av[r.avstep-1])..':'..tostring(r.av[lv]))
			for j = e + 1,#av/step do
		local deco, deci = scenetree.findObjectById(ro.id), scenetree.findObjectById(ri.id)
				lo('?? d_io:'..tostring(deco)..':'..tostring(deci))
		--- build exit decal
		local deco, deci = scenetree.findObjectById(ro.id), scenetree.findObjectById(ri.id)
				lo('?? d_io:'..tostring(deco)..':'..tostring(deci))
		--- build exit decal
		end
		lo('??---------------- BE:'..tostring(jb)..':'..tostring(je))
		local hmap, apin = av2hmap(edec, {
		end
		lo('??---------------- BE:'..tostring(jb)..':'..tostring(je))
		local hmap, apin = av2hmap(edec, {
	pout = fedge(inforo, -1)(eo)
--            lo('?? for_dec:'..tostring(inforo.id)..':'..tostring(deco))
	local vno = U.proj2D(pout - deco:getMiddleEdgePosition(eo)):normalized()
	pout = fedge(inforo, -1)(eo)
--            lo('?? for_dec:'..tostring(inforo.id)..':'..tostring(deco))
	local vno = U.proj2D(pout - deco:getMiddleEdgePosition(eo)):normalized()
	ppin = fedge(infori, -1)(eip) - vni*wExit/2
--    lo('<< exitIO:'..tostring(pout)..':'..tostring(ppout)..':'..tostring(pin)..':'..tostring(ppin))
	ppin = fedge(infori, -1)(eip) - vni*wExit/2
--    lo('<< exitIO:'..tostring(pout)..':'..tostring(ppout)..':'..tostring(pin)..':'..tostring(ppin))
	ppin = fedge(infori, -1)(eip) - vni*wExit/2
--    lo('<< exitIO:'..tostring(pout)..':'..tostring(ppout)..':'..tostring(pin)..':'..tostring(ppin))
	ppin = fedge(infori, -1)(eip) - vni*wExit/2
--    lo('<< exitIO:'..tostring(pout)..':'..tostring(ppout)..':'..tostring(pin)..':'..tostring(ppin))
			)
--                    lo('?? for_jb:'..i..':'..d..':'..tostring(pd))
			if pd ~= nil and d > pd and d > ro.w/2 + 2*marginSide then
	local pin, ppin = exitPos(ri, eii, -1, 1)
			lo('?? TEST_POS:'..tostring(pout)..':'..tostring(tp))
			adbg[#adbg + 1] = {pout, ColorF(1,1,0,1)}
	local pin, ppin = exitPos(ri, eii, -1, 1)
			lo('?? TEST_POS:'..tostring(pout)..':'..tostring(tp))
			adbg[#adbg + 1] = {pout, ColorF(1,1,0,1)}
			adbg[#adbg + 1] = {dec:getRightEdgePosition(je), ColorF(0,1,0,1)}
--    lo('??***** e4p1:'..tostring(pm1)..':'..tostring(edge4pos(pm1, dec)))
--    lo('??***** e4p2:'..tostring(pm2)..':'..tostring(edge4pos(pm2, dec)))
			adbg[#adbg + 1] = {dec:getRightEdgePosition(je), ColorF(0,1,0,1)}
--    lo('??***** e4p1:'..tostring(pm1)..':'..tostring(edge4pos(pm1, dec)))
--    lo('??***** e4p2:'..tostring(pm2)..':'..tostring(edge4pos(pm2, dec)))
--    lo('??***** e4p1:'..tostring(pm1)..':'..tostring(edge4pos(pm1, dec)))
--    lo('??***** e4p2:'..tostring(pm2)..':'..tostring(edge4pos(pm2, dec)))
	-- get branches heights
--    lo('??***** e4p1:'..tostring(pm1)..':'..tostring(edge4pos(pm1, dec)))
--    lo('??***** e4p2:'..tostring(pm2)..':'..tostring(edge4pos(pm2, dec)))
	-- get branches heights
	local hi = height4edge(ro.to[2], roads[ro.to[1]].hmap)
			lo('?? for_bht:'..ro.to[2]..':'..ri.to[2]..':'..tostring(ho)..':'..tostring(hi))
	local hmap, apin = av2hmap(dec, {
	local hi = height4edge(ro.to[2], roads[ro.to[1]].hmap)
			lo('?? for_bht:'..ro.to[2]..':'..ri.to[2]..':'..tostring(ho)..':'..tostring(hi))
	local hmap, apin = av2hmap(dec, {
		end
--        lo('?? for_h: i='..i..' h1:'..h1..' h2:'..h2..' cpin:'..cpin..':'..tostring(road.apin[cpin - 1])..':'..tostring(road.apin[cpin]))
		if road.apin[cpin-1][2] == 1 and road.apin[cpin][2] == 1 then
		end
--        lo('?? for_h: i='..i..' h1:'..h1..' h2:'..h2..' cpin:'..cpin..':'..tostring(road.apin[cpin - 1])..':'..tostring(road.apin[cpin]))
		if road.apin[cpin-1][2] == 1 and road.apin[cpin][2] == 1 then
	local adec = editor.getNodes(dec)
--        lo('?? to_del:'..r.id..':'..#adec..':'..tostring(r.meshid)..':'..#r.av..':'..nsec)
		if dbg then
--            lo('?? for_UPD:'..o..'/'..#adec..':'..tostring(apin[o]))
		end
		end
--                lo('?? np:'..o..':'..tostring(n.pos))
		n.pos.z = hmap[apin[o][1]] + 0.2
					apin[#apin + 1] = {i}
--                    lo('?? e2n:'..i..':'..j..':'..tostring(levels[r.dec2path[j]])..':'..tostring(hLevel))
					cdec = j + 1
					apin[#apin + 1] = {i}
--                    lo('?? e2n:'..i..':'..j..':'..tostring(levels[r.dec2path[j]])..':'..tostring(hLevel))
					cdec = j + 1
		apin[#apin + 1] = {nsec - 1}
--                lo('?? FOR_LAST:'..tostring(rd:getMiddleEdgePosition(nsec - 1))..':'..tostring(rd:getMiddleEdgePosition(nsec))..':'..tostring(adec[#adec].pos)..':'..#adec)
		r.hmap = hmap
		apin[#apin + 1] = {nsec - 1}
--                lo('?? FOR_LAST:'..tostring(rd:getMiddleEdgePosition(nsec - 1))..':'..tostring(rd:getMiddleEdgePosition(nsec))..':'..tostring(adec[#adec].pos)..':'..#adec)
		r.hmap = hmap
		apin[#apin + 1] = {nsec - 1}
--                lo('?? FOR_LAST:'..tostring(rd:getMiddleEdgePosition(nsec - 1))..':'..tostring(rd:getMiddleEdgePosition(nsec))..':'..tostring(adec[#adec].pos)..':'..#adec)
		r.hmap = hmap
		--- update decal
			lo('?? PRE_UP: nsec='..nsec..' adec='..#adec..':'..tostring(rd)..'::'..#hmap..'::'..tostring(#r.apin))
				U.dump(hmap, '?? hmap:')
		--- update decal
			lo('?? PRE_UP: nsec='..nsec..' adec='..#adec..':'..tostring(rd)..'::'..#hmap..'::'..tostring(#r.apin))
				U.dump(hmap, '?? hmap:')
		if (vflip - massCenter/#anode):length() > (v - massCenter/#anode):length() then
--            lo('?? TO_flip:'..stamp..':'..tostring(massCenter)..':'..#anode..':'..dmiddle)
			y = -y
	local v = U.vturn({x = x, y = y}, ang)
--            lo('?? cF2:'..x..':'..y..'::'..tostring(v)..':'..ang)
	local nd = {
		nd.pos = c1.pos + vn*(c1.r + dmiddle) + vec3(v.x, v.y, 0)
--        lo('!! sign: x:'..x..' y:'..y..' vn:'..tostring(vn)..' ang:'..ang..':'..tostring(spos)..'>'..tostring(nd.pos)..':'..math.abs((spos - c1.pos):length()/(c1.r + nd.r)))
	end
		nd.pos = c1.pos + vn*(c1.r + dmiddle) + vec3(v.x, v.y, 0)
--        lo('!! sign: x:'..x..' y:'..y..' vn:'..tostring(vn)..' ang:'..ang..':'..tostring(spos)..'>'..tostring(nd.pos)..':'..math.abs((spos - c1.pos):length()/(c1.r + nd.r)))
	end
		nd.pos = c1.pos + vn*(c1.r + dmiddle) + vec3(v.x, v.y, 0)
--        lo('!! sign: x:'..x..' y:'..y..' vn:'..tostring(vn)..' ang:'..ang..':'..tostring(spos)..'>'..tostring(nd.pos)..':'..math.abs((spos - c1.pos):length()/(c1.r + nd.r)))
	end
		local k = inear
--        lo('??******* int_resolve:'..i..':'..j..':'..inear..':'..tostring(nd.pos))
		-- select longer side
local function dump(node, yes)
--    lo('>> dump:'..tostring(yes)..':'..node.stamp)
	if (_dbg or state ~= nil) and yes == nil then
	local v, pair = node.pos, U.split(node.stamp, '_')
	fout:write(v.x..','..v.y..','..v.z..','..node.r..','..pair[1]..','..pair[2]..','..tostring(node.ang)..'\n')
end
	if U._PRD ~= 0 then return end
	lo('>>+++++++++++++++++++++++++ circleSeed:'..nnode..':'..tostring(mode)..':'..#anode..':'..tostring(_dbg))
	edges = {astamp = {}, infaces = {}}
	if U._PRD ~= 0 then return end
	lo('>>+++++++++++++++++++++++++ circleSeed:'..nnode..':'..tostring(mode)..':'..#anode..':'..tostring(_dbg))
	edges = {astamp = {}, infaces = {}}
		else
--            lo('?? from_state:'..i..':'..tostring(state[i]))
			ar[#ar + 1] = state[i].r
	anode[#anode + 1] = { pos = U.vturn(vec3(ar[1] + ar[2], 0, 0), ang), r = ar[2], ang = ang, stamp = '0_1' }
--            lo('?? FOR_2:'..tostring(ang)..':'..tostring(anode[#anode].pos)..':'..tostring(anode[#anode].ang))
--    U.dump(anode[#anode], '?? FOR_2:'..tostring(ang))
	anode[#anode + 1] = { pos = U.vturn(vec3(ar[1] + ar[2], 0, 0), ang), r = ar[2], ang = ang, stamp = '0_1' }
--            lo('?? FOR_2:'..tostring(ang)..':'..tostring(anode[#anode].pos)..':'..tostring(anode[#anode].ang))
--    U.dump(anode[#anode], '?? FOR_2:'..tostring(ang))
	anode[#anode + 1] = { pos = U.vturn(vec3(ar[1] + ar[2], 0, 0), ang), r = ar[2], ang = ang, stamp = '0_1' }
--            lo('?? FOR_2:'..tostring(ang)..':'..tostring(anode[#anode].pos)..':'..tostring(anode[#anode].ang))
--    U.dump(anode[#anode], '?? FOR_2:'..tostring(ang))
--            lo('?? FOR_2:'..tostring(ang)..':'..tostring(anode[#anode].pos)..':'..tostring(anode[#anode].ang))
--    U.dump(anode[#anode], '?? FOR_2:'..tostring(ang))
	edges.astamp[#edges.astamp + 1] = U.stamp({1, 2})
			d = state[i].d
--            lo('?? res_pair:'..i..":"..tostring(pair))
		else
			if state ~= nil then
--                lo('?? RE_pair:'..i..':'..state[i].stamp..':'..tostring(edges.infaces[state[i].stamp]))
			end
		end
--        lo('?? pre_fit:'..#anode..':'..tostring(anode[#anode].pos)..':'..anode[#anode].r)
		circleFit(pair, ar[i], d)
		local nm = rayCast.object.name
--		    lo('?? CE.RC:'..tostring(nm)..':'..tostring(rayCast.pos)) --..' true:'..tostring(cameraMouseRayCast(true).object.name)..' false:'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(editor.selection.forestItem)
		if nm ~= nil then
		local nm = rayCast.object.name
--		    lo('?? CE.RC:'..tostring(nm)..':'..tostring(rayCast.pos)) --..' true:'..tostring(cameraMouseRayCast(true).object.name)..' false:'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(editor.selection.forestItem)
		if nm ~= nil then
		local nm = rayCast.object.name
--		    lo('?? CE.RC:'..tostring(nm)..':'..tostring(rayCast.pos)) --..' true:'..tostring(cameraMouseRayCast(true).object.name)..' false:'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(editor.selection.forestItem)
		if nm ~= nil then
		local nm = rayCast.object.name
--		    lo('?? CE.RC:'..tostring(nm)..':'..tostring(rayCast.pos)) --..' true:'..tostring(cameraMouseRayCast(true).object.name)..' false:'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(editor.selection.forestItem)
		if nm ~= nil then
		local nm = rayCast.object.name
--		    lo('?? CE.RC:'..tostring(nm)..':'..tostring(rayCast.pos)) --..' true:'..tostring(cameraMouseRayCast(true).object.name)..' false:'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(editor.selection.forestItem)
		if nm ~= nil then
					local rd = rayCast.object
						lo('?? if_dec:'..tostring(rd.decal))
					if rd.decal ~= nil then
			else
--					lo('?? for_scope:'..tostring(W.forScope())..':'..nm)
				return W.mdown(rayCast, {R=R, D=D}) or nm ~= 'theTerrain'
			local r = 0.02*math.sqrt((s-core_camera.getPosition()):length())
	--        lo('?? for_dbg:'..tostring(s))
			if W.out.apop and W.out.apop[_] then
	for _,s in pairs(adbg) do
--        lo('?? DS:'..tostring(s[1]))
		local c = ColorF(1,0,0,1)
	for o = 1,#anode do
		debugDrawer:drawText(anode[o].pos, String(tostring(o)), ColorF(0,0,1,1))
	end
			ishit = onClick(editor.keyModifiers.alt)
--				lo('?? CE_postclick:'..tostring(ishit))
			if im.IsWindowHovered(im.HoveredFlags_AnyWindow) or im.IsAnyItemHovered() then
		local fdata = core_forest.getForestObject():getData()
			lo('?? BE.fdata1:'..tostring(fdata), true)
		local list = fdata:getItems()
		end
		print('?? ^^^^^^^^^^^ had_EROAD:'..tostring(scenetree.findObject('e_road')))
	end
local function onActivate()
--		print('>>______________________________________________________ onActivate:'..tostring(U._PRD))
--	lo('>> onActivate:'..tostring(isfirst)..':'..tostring(U._PRD)..' edit:'..tostring(scenetree.findObject('edit')))
--		print('>>______________________________________________________ onActivate:'..tostring(U._PRD))
--	lo('>> onActivate:'..tostring(isfirst)..':'..tostring(U._PRD)..' edit:'..tostring(scenetree.findObject('edit')))
--		print('>>______________________________________________________ onActivate:'..tostring(U._PRD))
--	lo('>> onActivate:'..tostring(isfirst)..':'..tostring(U._PRD)..' edit:'..tostring(scenetree.findObject('edit')))
--		print('>>______________________________________________________ onActivate:'..tostring(U._PRD))
--	lo('>> onActivate:'..tostring(isfirst)..':'..tostring(U._PRD)..' edit:'..tostring(scenetree.findObject('edit')))
	end
--			print('?? to_inject:'..tostring(U._PRD))
	W.up(D, nil, true)
local function onDeactivate()
--		print('>> onDeactivate:'..tostring(U._PRD)..':'..tostring(scenetree.findObject('e_road')))
		if scenetree.findObject('e_road') then
local function onDeactivate()
--		print('>> onDeactivate:'..tostring(U._PRD)..':'..tostring(scenetree.findObject('e_road')))
		if scenetree.findObject('e_road') then
	if U._PRD == 1 then
--			print('?? BAT_deact:'..tostring(scenetree.findObject('e_road')))
		if scenetree.findObject('edit') then
			scenetree.MissionGroup:removeObject(scenetree.findObject('edit'))
        		lo('?? onDeactivate_edit_REMOVED:'..tostring(scenetree.findObject('edit')))
	--        scenetree.findObject('edit'):delete()
	for i,d in pairs(dexp) do
--			lo('?? for_EXP:'..tostring(d.label)..':'..tostring(d.obj.isactive))
		if d.obj and d.obj.isactive and d.obj.gui then d.obj.gui() end
	for i,d in pairs(dexp) do
--			lo('?? for_EXP:'..tostring(d.label)..':'..tostring(d.obj.isactive))
		if d.obj and d.obj.isactive and d.obj.gui then d.obj.gui() end
		if d.obj and d.obj.isactive and d.obj.gui then d.obj.gui() end
--			lo('?? for_EXP:'..i..':'..tostring(d.obj.out.up)..':'..tostring(d))
		if d.obj and d.obj.isactive and d.obj.update then
		if d.obj and d.obj.isactive and d.obj.gui then d.obj.gui() end
--			lo('?? for_EXP:'..i..':'..tostring(d.obj.out.up)..':'..tostring(d))
		if d.obj and d.obj.isactive and d.obj.update then
--	U._MODE = mode
	lo('>> bE.onDeserialize:'..tostring(data)..':'..tostring(data['jdata'] and true or false))
	if not W then
--	U._MODE = mode
	lo('>> bE.onDeserialize:'..tostring(data)..':'..tostring(data['jdata'] and true or false))
	if not W then
local function onSerialize()
--		print('??^^^^^^^^^^ onSerialize:'..tostring(scenetree.findObject('e_road')))
	if scenetree.findObject('e_road') then
	local jdata = W.onQuit()
--		print('?? onSer:'..tostring(U._MODE))
		lo('>> bE.onSerialize:') --..#jdata)
local function onEditorInitialized()
	lo('?? onEditorInitialized:'..tostring(U)..':'..tostring(U._PRD))
local function onEditorInitialized()
	lo('?? onEditorInitialized:'..tostring(U)..':'..tostring(U._PRD))
	local fprod = FS:fileExists('/lua/ge/extensions/editor/gen/inprod') --io.open(fname, "r")
--			lo('?? if_PROD:'..tostring(fprod))
	if fprod then
			end, {groupMenuName = 'Experimental'})
				lo('??_____*********** to_MENU:'..d.label..':'..tostring(d.onstart))
			if d.onstart == true then
			--TODO: this print was in production, please comment when releasing
			--lo('>> onEditorObjectSelectionChanged:'..tostring(editor.selection.object[1])) --..tostring(scenetree.findObjectById(editor.selection.object[1]).name))
--        D.ter2road()
			--TODO: this print was in production, please comment when releasing
			--lo('>> onEditorObjectSelectionChanged:'..tostring(editor.selection.object[1])) --..tostring(scenetree.findObjectById(editor.selection.object[1]).name))
--        D.ter2road()
@/lua/ge/extensions/editor/roadSpline/import.lua
    table.insert(layers, {
      name = 'Imported ' .. tostring(#layers + 1) .. ' ' .. road:getID(),
      id = Engine.generateUUID(),
  local groups = groupMgr.getGroups()
  groupMgr.addNewGroup('Import ' .. tostring(#groups))
  local group = groups[#groups]
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/loop/routeAfterRoadSection.lua

  log('D', logTag, 'Current mission: ' .. tostring(currentMissionId))
@/lua/common/libs/luamqtt/mqtt/protocol.lua
	if val < 0 or val > 0xFF then
		error("value is out of range to encode as uint8: "..tostring(val))
	end
	if val < 0 or val > 0xFFFF then
		error("value is out of range to encode as uint16: "..tostring(val))
	end
	if val < 0 or val > 0xFFFFFFFF then
		error("value is out of range to encode as uint32: "..tostring(val))
	end
	if len < 0 or len > 268435455 then
		error("value is invalid for encoding as variable length field: "..tostring(len))
	end
		for i, part in ipairs(self) do
			strings[i] = tostring(part)
		end
	else
		return tostring(value)
	end
	end
	return str_format("%s{%s}", tostring(packet_type[packet.type]), tbl_concat(res, ", "))
end
@/lua/ge/extensions/editor/missionPlaybook.lua
  if not json then
    log('E', logTag, 'unable to find Book: ' .. tostring(filename))
    return
      end
      im.Text(tostring(i))
      if not condensed then
@/lua/ge/extensions/flowgraph/nodes/gameplay/countdown.lua
      ttl = 1,
      msg = tostring(msg),
      category =  ("countdown__"..self.id),
@/lua/ge/setSpawnpoint.lua
  if not levelInfo then
    log('E', 'spawnpoint', 'unable to read mission info: ' .. tostring(levelname))
    return ''
      else
        log('W', logTag, tostring(dataLevel.defaultSpawnPointName)..' not in the mission file spawn vehicle in the default position')
      end
@/lua/ge/extensions/editor/gen/exp_meshexplorer.lua
    if not ajpart then return end
--`        lo('>> partPin:'..tostring(cpart))
    ageopin = {}
--                    lo('?? to_SEL:'..k)
--                    lo('?? if_IND:'..tostring(name2ind[k]))
                ageopin[#ageopin+1] = daedata.dgeo[name2ind[k]].key
local function forParam()
--        lo('>> forParam:'..tostring(beamdata.agpick and #beamdata.agpick or 0)..':'..tostring(beamdata.abeampick and #beamdata.abeampick or 0))
    if beamdata.abeampick and #beamdata.abeampick>0 then
local function forParam()
--        lo('>> forParam:'..tostring(beamdata.agpick and #beamdata.agpick or 0)..':'..tostring(beamdata.abeampick and #beamdata.abeampick or 0))
    if beamdata.abeampick and #beamdata.abeampick>0 then
        cobj = spawn.spawnVehicle(amodel[env.ui['model_up']], nil, vec3(0,0,0), quat(0,0,1,0)):getId()
            lo('?? if_COOO:'..tostring(cobj))
        break
--        local pos = vec3(0.0002040175605,-0.001240882906,0.3043344319)
--        lo('?? forBeams:'..tostring(pos))
        if d.key == key and d.abeam then
--                dump(d.abeam,'?? for_BM:'..tostring(#d.abeam))
            return U.map(d.abeam,function(k,v)
    -- goto file for groups
        lo('?? fof:'..tostring(beamdata.cpart.name))
        local pvd = extensions.core_vehicle_manager.getPlayerVehicleData()
--            dump(pvd.config,'?? PVD:'..tostring(pvd.config),nil)
        local dbeam = M.forBeams(pvd.vdata.beams)
            local vehData = core_vehicle_manager.getVehicleData(id)
                dump(vehData.ioCtx.preloadedDirs,'?? vehData:'..tostring(vehData.ioCtx))
--            local pfmap = jbeamIO.getPFMap()
            if d.model_key == 'pickup' then
--                dump(d,'?? OD:'..j) --..tostring(d.offsetData))
--                lo('?? OD:'..j..':'..d.pcFilename) --..tostring(d.offsetData))
--                dump(d,'?? OD:'..j) --..tostring(d.offsetData))
--                lo('?? OD:'..j..':'..d.pcFilename) --..tostring(d.offsetData))
            end
                c={0,1,1},w=0.01}
--            dump(ac, '?? if_LINE:'..tostring(r))
            U.out.aset[3] = {set = {vec3(ac[1],ac[2],ac[3]),vec3(ac[4],ac[5],ac[6])},w=0.01}
        local opt = sanitizeVehicleSpawnOptions('pickup',{}) --, localOptions)
            lo('?? opt_POS:'..tostring(opt.pos))
--[[
            if d.model_key == 'pickup' then
--                lo('?? OD:'..tostring(d.offsetData))
            end
-- .beamDamp .beamDeform .beamSpring .beamLimitSpring .beamStrength
--            dump(pvd.vdata.beams, '?? vdata_rn:'..tostring(pvd.vdata.refNodes.ref)..':'..#pvd.vdata.nodes..':'..tostring(pvd.vdata.nodes[pvd.vdata.refNodes[0].ref].pos),nil,2)
--            dump(pvd.vdata.variables, '?? vdata_var:',nil,2)
-- .beamDamp .beamDeform .beamSpring .beamLimitSpring .beamStrength
--            dump(pvd.vdata.beams, '?? vdata_rn:'..tostring(pvd.vdata.refNodes.ref)..':'..#pvd.vdata.nodes..':'..tostring(pvd.vdata.nodes[pvd.vdata.refNodes[0].ref].pos),nil,2)
--            dump(pvd.vdata.variables, '?? vdata_var:',nil,2)
        for id, veh in activeVehiclesIterator() do
            lo('??++++++++++++++++++++++ veh:'..id..':'..veh:getNodeCount()..':'..tostring(veh:getNodePosition(1))..':'..veh:getJBeamFilename()) --.':'..tostring(veh:getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId()))) --..':'..tableSize(veh.vdata.beams))
            lo('?? forPos:'..tostring(veh:getPosition())..':'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId())))
        for id, veh in activeVehiclesIterator() do
            lo('??++++++++++++++++++++++ veh:'..id..':'..veh:getNodeCount()..':'..tostring(veh:getNodePosition(1))..':'..veh:getJBeamFilename()) --.':'..tostring(veh:getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId()))) --..':'..tableSize(veh.vdata.beams))
            lo('?? forPos:'..tostring(veh:getPosition())..':'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId())))
        for id, veh in activeVehiclesIterator() do
            lo('??++++++++++++++++++++++ veh:'..id..':'..veh:getNodeCount()..':'..tostring(veh:getNodePosition(1))..':'..veh:getJBeamFilename()) --.':'..tostring(veh:getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId()))) --..':'..tableSize(veh.vdata.beams))
            lo('?? forPos:'..tostring(veh:getPosition())..':'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId())))
            lo('??++++++++++++++++++++++ veh:'..id..':'..veh:getNodeCount()..':'..tostring(veh:getNodePosition(1))..':'..veh:getJBeamFilename()) --.':'..tostring(veh:getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId()))) --..':'..tableSize(veh.vdata.beams))
            lo('?? forPos:'..tostring(veh:getPosition())..':'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId())))
        end
            lo('??++++++++++++++++++++++ veh:'..id..':'..veh:getNodeCount()..':'..tostring(veh:getNodePosition(1))..':'..veh:getJBeamFilename()) --.':'..tostring(veh:getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId()))) --..':'..tableSize(veh.vdata.beams))
            lo('?? forPos:'..tostring(veh:getPosition())..':'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId())))
        end
            lo('??++++++++++++++++++++++ veh:'..id..':'..veh:getNodeCount()..':'..tostring(veh:getNodePosition(1))..':'..veh:getJBeamFilename()) --.':'..tostring(veh:getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId()))) --..':'..tableSize(veh.vdata.beams))
            lo('?? forPos:'..tostring(veh:getPosition())..':'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId())))
        end
        local box = vo:getWorldBox()
            lo('?? for_BOX:'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(box.minExtents)..':'..tostring(box.maxExtents)..':'..tostring(pvd.pos))
--        local pos = (box.minExtents+box.maxExtents)/2
        local box = vo:getWorldBox()
            lo('?? for_BOX:'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(box.minExtents)..':'..tostring(box.maxExtents)..':'..tostring(pvd.pos))
--        local pos = (box.minExtents+box.maxExtents)/2
        local box = vo:getWorldBox()
            lo('?? for_BOX:'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(box.minExtents)..':'..tostring(box.maxExtents)..':'..tostring(pvd.pos))
--        local pos = (box.minExtents+box.maxExtents)/2
        local box = vo:getWorldBox()
            lo('?? for_BOX:'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(box.minExtents)..':'..tostring(box.maxExtents)..':'..tostring(pvd.pos))
--        local pos = (box.minExtents+box.maxExtents)/2
        local pvd = extensions.core_vehicle_manager.getPlayerVehicleData()
--            lo('?? for_PVD:'..tostring(pvd))
        am = M.gpuFrom(pvd.id)
                end
                    lo('?? mmBEAMS:'..tostring(mi)..':'..tostring(ma)..':'..(ma.x-mi.x)..':'..(ma.y-mi.y))
                    lo('?? mmBOX:'..(box.maxExtents.x-box.minExtents.x)..':'..(box.maxExtents.y-box.minExtents.y))
                end
                    lo('?? mmBEAMS:'..tostring(mi)..':'..tostring(ma)..':'..(ma.x-mi.x)..':'..(ma.y-mi.y))
                    lo('?? mmBOX:'..(box.maxExtents.x-box.minExtents.x)..':'..(box.maxExtents.y-box.minExtents.y))
                                for _,v in pairs(m.verts) do
            --                            dump(a, '?? for_v:'..tostring(v))
                                    local d = v:distance(a.pos)
                    if not hit then
        --                    dump(b[1].av, '?? miss:'..k..':'..tostring(b[1]), nil, 1)
                    end
        local abeam = forBeams(31)
            lo('?? abeamL:'..tostring(abeam))
            U.out.agraph[1] = {list=apath, c={1,0,0,0.2}, w=2,z=false}
--            dump(U.out.agraph[1].list,'?? apath:'..tostring(apath[1][1])..'/'..#apath)
--        for i,b in pairs(pvd.vdata.beams) do
        for id, veh in activeVehiclesIterator() do
            lo('??++++++++++++++++++++++ veh:'..id..':'..veh:getNodeCount()..':'..tostring(veh:getNodePosition(1))..':'..veh:getJBeamFilename()..':'..veh:getId()) --..':'..tableSize(veh.vdata.beams))
        end
            local dir = vec3(1,0,0)*t + vec3(1,1,0)
            lo('?? for_dir:'..tostring(quatFromDir()))
        end
        po.hidden = false
--            lo('?? if_PL:'..tostring(po and po.hidden or 'none'))
        return
                    local icn = editor.texObj(d['preview'])
                    if tostring(icn.format) ~= 'no_format' then
--                    if tostring(icn.file) ~= 'empty.jpg' then
                    if tostring(icn.format) ~= 'no_format' then
--                    if tostring(icn.file) ~= 'empty.jpg' then
                        dimg[d.model_key] = icn
                        dimg[d.model_key] = icn
--                        lo('?? fl:'..tostring(icn.file))
                    else
            local model = core_vehicles.getModel(config.model_key).model
--                if _ == 1 then dump(config, '?? for_MODEL:'..tostring(config.model_key)) end
            local icn = editor.texObj(config['preview'])
                end
--                if _ == 1 then dump(icn, '?? for_MODEL:'..tostring(config.model_key)) end
            if icn.file ~= 'empty.jpg' then
            end
--                lo('?? ICN:'.._..':'..tostring(icn))
            ::continue::
            lo('?? NIN:'..#amodel..':'..tableSize(dimg)..'/'..#data.configs)
--            dump(dimg, '?? if_TILES:'..tostring(data))
        return
        for modelName, _ in pairs(core_vehicles.getModelsData()) do
            lo('?? for_model:'..modelName..':'..tostring(core_vehicles.getModel(modelName).model))
        end
                    vid = veh:getId()
                        lo('?? VID:'..tostring(vid))
                else
--                dump(playerVehicle.vdata.nodes[#playerVehicle.vdata.nodes],'??==================== vehDATA_node:'..#playerVehicle.vdata.nodes,nil)
--                dump(playerVehicle.vdata.triangles[1],'??==================== vehDATA_trng:'..tostring(#playerVehicle.vdata.triangles),nil)
--                dump(playerVehicle.vdata.beams[1],'??==================== vehDATA_beam:'..tostring(#playerVehicle.vdata.beams),nil)
--                dump(playerVehicle.vdata.triangles[1],'??==================== vehDATA_trng:'..tostring(#playerVehicle.vdata.triangles),nil)
--                dump(playerVehicle.vdata.beams[1],'??==================== vehDATA_beam:'..tostring(#playerVehicle.vdata.beams),nil)
--                dump(playerVehicle.vdata.components,'??==== vehDATA:',nil,2)

--                dump(amesh[1].data,'??______________ for_m:'..tostring(amesh[1]),nil,2)
    --        local anode = editor.getNodes(obj)
    --        local anode = editor.getNodes(obj)
    --            print('?? NODES:'..tostring(obj.vehId))
        end

--                            lo('?? FAFFFFPPPP:'..tableSize(bag)..':'..tostring(am[1].faces))
--                        dump(bag, '?? FAFFFFPPPP:'..tableSize(bag))
                lo('?? bufs:'..#av..':'..#an..':'..#auv..':'..#af..':'..lastMeshInfo.uv1Count..':'..#am)
                dump(auv[1], tostring(av[1])..':'..tostring(an[1]))
                dump(af[1], '?? faces1:')
                lo('?? bufs:'..#av..':'..#an..':'..#auv..':'..#af..':'..lastMeshInfo.uv1Count..':'..#am)
                dump(auv[1], tostring(av[1])..':'..tostring(an[1]))
                dump(af[1], '?? faces1:')
--[[
                lo('?? aaa:'..tostring(vertices[2]))
--            local s = ffi.string(vertices)
            local floatByteSize = ffi.sizeof('float')
                lo('??+++++++++++++ MI:'..lastMeshInfo.verticesCount..':'..tostring(vertices))
--            local vertexAccessorID = _addVec3Buffer(gltfRoot, lastMeshInfo.verticesCount, vertices, "vertices")
--                print('?? CHAR:'..string.char(string.byte(binstr, 1, 100))) -- string.len(binstr)))
--            local s = dataString:tostring()
--                lo('?? ss:'..string.sub(s, 1, 100))
    env = W
        lo('>> E_ME.up:'..tostring(M)..':'..tostring(ind))
--        if true then return end
    env = W
        lo('>> E_ME.up:'..tostring(M)..':'..tostring(ind))
--        if true then return end
--    wnm = lbl --'EXP_'..ind
--        print('?? if_REG:'..wnm..':'..tostring(editor.isWindowRegistered(wnm)))
    if not editor.isWindowRegistered(wnm) then
        for i,m in pairs(list) do
--            lo('?? for_MAT:'..tostring(m.name))
            dmat[m.name] = {body=m}
        amodel[#amodel+1] = modelName
--        lo('?? for_model:'..modelName..':'..tostring(core_vehicles.getModel(modelName).model))
    end

--        lo('??^^^^^^^^^^^^^^^^^^^^^^^^ if_MODEL:'..tostring(obj.model)..':'..tostring(cdae))
    if true and cdae then

--        lo('??^^^^^^^^^^^^^^^^^^^^^^^^ if_MODEL:'..tostring(obj.model)..':'..tostring(cdae))
    if true and cdae then
--        dump(dmat, '?? DMAT:')
        lo('<< up:'..tostring(cdae))
        if U._PRD == 0 then
	for k,v in pairs(matFiles) do
--			lo('?? for_mat_FILE:'..tostring(v))
		loadJsonMaterialsFile(v)
		for _, obj in ipairs(objects) do
--				if true or U._PRD == 0 then lo('?? for_mat:'..tostring(obj.name)..':'..tostring(scenetree.findObject(obj.name))) end --..tostring(obj.doubleSided))
			obj.doubleSided = true
		for _, obj in ipairs(objects) do
--				if true or U._PRD == 0 then lo('?? for_mat:'..tostring(obj.name)..':'..tostring(scenetree.findObject(obj.name))) end --..tostring(obj.doubleSided))
			obj.doubleSided = true
		for _, obj in ipairs(objects) do
--				if true or U._PRD == 0 then lo('?? for_mat:'..tostring(obj.name)..':'..tostring(scenetree.findObject(obj.name))) end --..tostring(obj.doubleSided))
			obj.doubleSided = true

--            lo('?? materialLoad:'.._..':'..tostring(obj))
			list[#list + 1] = obj
				local mo = scenetree.findObject(nm)
--                    lo('?? for_roof_COM:'..tostring(nm)..':'..tostring(mo))
				if mo then
				local mo = scenetree.findObject(nm)
--                    lo('?? for_roof_COM:'..tostring(nm)..':'..tostring(mo))
				if mo then
    local adir = FS:directoryList(path..'/', false, true)
--        dump(adir,'>> dir2list:'..path..':'..tostring(#adir)..':'..#afav)
    local out,outf = {},{}
    for i,f in pairs(list) do
--            lo('?? fof:'..i..':'..tostring(f))
        f = U.split(f, '/', true)
        end
--            lo('?? for_K:'..tostring(k))
--                k='Mesh_160-mesh'
--            daedata.djoint[k] = jnt
--                lo('??^^^^^^^^^^^^^^^ jnt:'..val..'>'..k..':'..tostring(#jnt))
            if jnt then
                        hit = true
--                            lo('?? HIT:'..tostring(b.stamp)..':'..tostring(val))
--                        ahl[#ahl+1] = b
                        hit = true
--                            lo('?? HIT:'..tostring(b.stamp)..':'..tostring(val))
--                        ahl[#ahl+1] = b
    gkey = gkey or (beamdata.agpick and beamdata.agpick[1].key)
--        lo('>> groupExtract:'..tostring(gkey)..':'..tostring(#beamdata.abeampick))
--        dump(abeampick, '>> groupExtract:'..tostring(beamdata.agpick[1].key))
    gkey = gkey or (beamdata.agpick and beamdata.agpick[1].key)
--        lo('>> groupExtract:'..tostring(gkey)..':'..tostring(#beamdata.abeampick))
--        dump(abeampick, '>> groupExtract:'..tostring(beamdata.agpick[1].key))
--        lo('>> groupExtract:'..tostring(gkey)..':'..tostring(#beamdata.abeampick))
--        dump(abeampick, '>> groupExtract:'..tostring(beamdata.agpick[1].key))
    local ahl,aplain,go,abm = groupExtract(gkey, abeampick)
                elseif string.find(s,'["',1,true) then
--                        lo('?? ingh:'..i..':'..tostring(_ingroup))
--                        lo('?? inb2:'..i..':'..tostring(_ingroup)..':'..groupn)
--                        lo('?? ingh:'..i..':'..tostring(_ingroup))
--                        lo('?? inb2:'..i..':'..tostring(_ingroup)..':'..groupn)
                    if not _ingroup then
        beamdata.anode = pvd.vdata.nodes
            lo('?? to_ghost:'..tostring(cpreview)..':'..tostring(cobj)..':'..tostring(scenetree.findObjectById(cobj):getPosition()))
        beamdata.ds = -pvd.vdata.nodes[pvd.vdata.refNodes[0].ref].pos -- + scenetree.findObjectById(cpreview):getPosition()
        beamdata.anode = pvd.vdata.nodes
            lo('?? to_ghost:'..tostring(cpreview)..':'..tostring(cobj)..':'..tostring(scenetree.findObjectById(cobj):getPosition()))
        beamdata.ds = -pvd.vdata.nodes[pvd.vdata.refNodes[0].ref].pos -- + scenetree.findObjectById(cpreview):getPosition()
        beamdata.anode = pvd.vdata.nodes
            lo('?? to_ghost:'..tostring(cpreview)..':'..tostring(cobj)..':'..tostring(scenetree.findObjectById(cobj):getPosition()))
        beamdata.ds = -pvd.vdata.nodes[pvd.vdata.refNodes[0].ref].pos -- + scenetree.findObjectById(cpreview):getPosition()
    wnm = 'EXP_'..'1'
--        print('?? if_REG:'..wnm..':'..tostring(editor.isWindowRegistered(wnm)))
    if not editor.isWindowRegistered(wnm) then
--        amodel[#amodel+1] = modelName
--        lo('?? for_model:'..modelName..':'..tostring(core_vehicles.getModel(modelName).model))
--    end
    W.onVal('model_on') --,obj.model)
        lo('?? IF:'..tostring(inmesh)..':'..tostring(W.out.up)..':'..tostring(env.ui['model_up'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(beamdata.cpart))
    W.onVal('model_on') --,obj.model)
        lo('?? IF:'..tostring(inmesh)..':'..tostring(W.out.up)..':'..tostring(env.ui['model_up'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(beamdata.cpart))
    W.onVal('model_on') --,obj.model)
        lo('?? IF:'..tostring(inmesh)..':'..tostring(W.out.up)..':'..tostring(env.ui['model_up'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(beamdata.cpart))
    W.onVal('model_on') --,obj.model)
        lo('?? IF:'..tostring(inmesh)..':'..tostring(W.out.up)..':'..tostring(env.ui['model_up'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(beamdata.cpart))
    W.onVal('model_on') --,obj.model)
        lo('?? IF:'..tostring(inmesh)..':'..tostring(W.out.up)..':'..tostring(env.ui['model_up'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(beamdata.cpart))
    beamdata.abeam = beamdata.dbeam[partname].list
--        lo('?? dBEAM:'..tostring(daedata.dbeam))
    daedata.ageo = {}
    daedata.ageo = {}
--        lo('?? ajpart:'..#ajpart..':'..tostring(env.ui['model_on']))
--        lo('?? to_PICK:'..tostring(env.ui['jpart_pick'])..':'..tostring(beamdata.cpart.key))
--        lo('?? ajpart:'..#ajpart..':'..tostring(env.ui['model_on']))
--        lo('?? to_PICK:'..tostring(env.ui['jpart_pick'])..':'..tostring(beamdata.cpart.key))
    W.onVal('jpart_pick', beamdata.cpart.key) --env.ui['jpart_pick'])
--        lo('?? ajpart:'..#ajpart..':'..tostring(env.ui['model_on']))
--        lo('?? to_PICK:'..tostring(env.ui['jpart_pick'])..':'..tostring(beamdata.cpart.key))
    W.onVal('jpart_pick', beamdata.cpart.key) --env.ui['jpart_pick'])
--    W.out.up = true
--        lo('?? if_COBJ:'..tostring(cobj))
--    for id, veh in activeVehiclesIterator() do
    if not mute then
        lo('>> onVal:'..tostring(key)..':'..tostring(val))
    end
    if not mute then
        lo('>> onVal:'..tostring(key)..':'..tostring(val))
    end
        local ain,iins = beamDel(beamdata.abeampick,aline)
            lo('?? to_INS:'..tostring(iins)..':'..#ain)
        for i=#ain,1,-1 do
        for k,p in pairs(dextparam) do
            lo('?? for_PARAM:'..k..':'..tostring(p == nil)..':'..tostring(tostring(p) == '')..'>'..tostring(p)..'<')
            if tostring(p) == '' then
        for k,p in pairs(dextparam) do
            lo('?? for_PARAM:'..k..':'..tostring(p == nil)..':'..tostring(tostring(p) == '')..'>'..tostring(p)..'<')
            if tostring(p) == '' then
        for k,p in pairs(dextparam) do
            lo('?? for_PARAM:'..k..':'..tostring(p == nil)..':'..tostring(tostring(p) == '')..'>'..tostring(p)..'<')
            if tostring(p) == '' then
        for k,p in pairs(dextparam) do
            lo('?? for_PARAM:'..k..':'..tostring(p == nil)..':'..tostring(tostring(p) == '')..'>'..tostring(p)..'<')
            if tostring(p) == '' then
            lo('?? for_PARAM:'..k..':'..tostring(p == nil)..':'..tostring(tostring(p) == '')..'>'..tostring(p)..'<')
            if tostring(p) == '' then
                dextparam[k] = nil
        file.close()
--            lo('?? pre_RELOAD:'..tostring(beamdata.cpart.key))
--        partUp(beamdata.cpart)
        beamdata.agpick[1].exp = true
--            lo('?? post_RELOAD:'..tostring(env.ui['jpart_pick'])..':'..tostring(beamdata.cpart))
        beamdata.agpick[1].exp = true
--            lo('?? post_RELOAD:'..tostring(env.ui['jpart_pick'])..':'..tostring(beamdata.cpart))

                lo('?? for_MOD:'..tostring(amodel[env.ui['model_up']]))
--..':'..tostring(env.ui['geo_on'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(ageopin[1])..':'..tostring(beamdata.cpart.name))
                lo('?? for_MOD:'..tostring(amodel[env.ui['model_up']]))
--..':'..tostring(env.ui['geo_on'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(ageopin[1])..':'..tostring(beamdata.cpart.name))
--                if true then return end
                lo('?? for_MOD:'..tostring(amodel[env.ui['model_up']]))
--..':'..tostring(env.ui['geo_on'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(ageopin[1])..':'..tostring(beamdata.cpart.name))
--                if true then return end
                lo('?? for_MOD:'..tostring(amodel[env.ui['model_up']]))
--..':'..tostring(env.ui['geo_on'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(ageopin[1])..':'..tostring(beamdata.cpart.name))
--                if true then return end
                lo('?? for_MOD:'..tostring(amodel[env.ui['model_up']]))
--..':'..tostring(env.ui['geo_on'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(ageopin[1])..':'..tostring(beamdata.cpart.name))
--                if true then return end
            for id, veh in activeVehiclesIterator() do
--                lo('?? for_VEH:'..tostring(veh:getId()))
                local om = scenetree.findObjectById(veh:getId())
                local om = scenetree.findObjectById(veh:getId())
--                lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
                    lo('?? now:'..tostring(om))
                local om = scenetree.findObjectById(veh:getId())
--                lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
                    lo('?? now:'..tostring(om))
--                lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
                    lo('?? now:'..tostring(om))
                if om then om:delete() end
                local tveh = spawn.spawnVehicle('metal_box', nil, vec3(0,0,0), quat(0,0,1,0))
                    lo('?? mid:'..tostring(tveh))
                scenetree.findObjectById(tveh:getId()):delete()
                    if string.find(s,'["',1,true) then
    --                        lo('?? ingh:'..i..':'..tostring(_ingroup))
                            lo('?? inb2:'..i..':'..tostring(_ingroup)..':'..groupn)
    --                        lo('?? ingh:'..i..':'..tostring(_ingroup))
                            lo('?? inb2:'..i..':'..tostring(_ingroup)..':'..groupn)
                        if not _ingroup then
        file.close()
            lo('?? changed:'..tostring(env.ui['model_up']))

                lo('?? for_MOD:'..tostring(amodel[env.ui['model_up']]))
                --..':'..tostring(env.ui['geo_on'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(ageopin[1])..':'..tostring(beamdata.cpart.name))
                lo('?? for_MOD:'..tostring(amodel[env.ui['model_up']]))
                --..':'..tostring(env.ui['geo_on'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(ageopin[1])..':'..tostring(beamdata.cpart.name))
--                if true then return end
                lo('?? for_MOD:'..tostring(amodel[env.ui['model_up']]))
                --..':'..tostring(env.ui['geo_on'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(ageopin[1])..':'..tostring(beamdata.cpart.name))
--                if true then return end
                lo('?? for_MOD:'..tostring(amodel[env.ui['model_up']]))
                --..':'..tostring(env.ui['geo_on'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(ageopin[1])..':'..tostring(beamdata.cpart.name))
--                if true then return end
                lo('?? for_MOD:'..tostring(amodel[env.ui['model_up']]))
                --..':'..tostring(env.ui['geo_on'])..':'..tostring(env.ui['jpart_pick'])..':'..tostring(ageopin[1])..':'..tostring(beamdata.cpart.name))
--                if true then return end
            for id, veh in activeVehiclesIterator() do
--                lo('?? for_VEH:'..tostring(veh:getId()))
                local om = scenetree.findObjectById(veh:getId())
                local om = scenetree.findObjectById(veh:getId())
--                lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
                if om then om:delete() end
                local om = scenetree.findObjectById(veh:getId())
--                lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
                if om then om:delete() end
--                    local po = scenetree.findObject("thePlayer")
--                    lo('?? if_PO:'..tostring(po.id)..':'..tostring(po:getId()))
--                    local om = scenetree.findObjectById(po:getId())
--                    local po = scenetree.findObject("thePlayer")
--                    lo('?? if_PO:'..tostring(po.id)..':'..tostring(po:getId()))
--                    local om = scenetree.findObjectById(po:getId())
--                    local om = scenetree.findObjectById(po:getId())
--                    lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
--                    if om then om:delete() end
--                    local om = scenetree.findObjectById(po:getId())
--                    lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
--                    if om then om:delete() end
            local veh = spawn.spawnVehicle(amodel[env.ui['model_up'] ], nil, vec3(0,0,0), quat(0,0,1,0))
                lo('?? for_VEH:'..tostring(veh))
            cobj = veh:getId()
    elseif key == 'group_in' then
            lo('?? GI:'..val..':'..tostring(beamdata.abeampick and #beamdata.abeampick or 0))
        ispset = false
        beamdata.agpick = {g}
            lo('?? agpick:'..#beamdata.agpick..':'..tostring(beamdata.cpart.name)..':'..tostring(beamdata.dbeam))
--        local ma = beamdata.dbeam[beamdata.cpart.name].ma
        beamdata.agpick = {g}
            lo('?? agpick:'..#beamdata.agpick..':'..tostring(beamdata.cpart.name)..':'..tostring(beamdata.dbeam))
--        local ma = beamdata.dbeam[beamdata.cpart.name].ma
        end
            dump(part.amesh,'?? jpick:'..val..':'..tostring(unsel))
        ageopin = {}
                for _,k in pairs(part.amesh) do
    --                    lo('?? if_IND:'..tostring(name2ind[k]))
                    ageopin[#ageopin+1] = daedata.dgeo[name2ind[k] ].key
            local om = amesh[env.ui['lod_up']].body
--                    dump(amesh[env.ui['lod_up']].data,'?? if_DATA:'..tostring(amesh[env.ui['lod_up']].data),nil,1)
            om:createMesh({})
    elseif key == 'piece_up' then
            lo('?? piece_up:'..tostring(val))
        if val then
                local af = {}
--                    lo('?? if_BAG:'..i..':'..tostring(#geo.fbag)..':'..tostring(apiece[1]))
                -- pieces union
                local af = {}
--                    lo('?? if_BAG:'..i..':'..tostring(#geo.fbag)..':'..tostring(apiece[1]))
                -- pieces union
                    {m=m,aiv={},aif=fbag})
--                        lo('?? if_AIV:'..i..':'..tostring(aiv))
        --            U.out.aset[1] = {set=djoint[val]}
                        local r,ac,sac = AI.line(set)
                            lo('?? if_LINE: geo:'..i..':'..tostring(r))
                        if r < 0.04 then
                local box = amesh[i].body:getWorldBox()
                    lo('?? lod_over:'..daedata.alod[val].zma) --..val..'/'..tostring(env.ui[key])..':'..tostring(pos))
                W.out.cmesh = pos + vec3(0,0,daedata.alod[val].zma + 0.25) --+ vec3(0,0,box.maxExtents.z - box.minExtents.z)
                local box = amesh[i].body:getWorldBox()
                    lo('?? lod_over:'..daedata.alod[val].zma) --..val..'/'..tostring(env.ui[key])..':'..tostring(pos))
                W.out.cmesh = pos + vec3(0,0,daedata.alod[val].zma + 0.25) --+ vec3(0,0,box.maxExtents.z - box.minExtents.z)
        env.ui['model_on'] = not env.ui['model_on']
--            lo('?? ifMON:'..tostring(env.ui['model_on']))
        if env.ui['model_on'] then
                            local icn = editor.texObj(d['preview'])
                            if tostring(icn.format) ~= 'no_format' then
                                dimg[d.model_key] = icn
        local pos = amesh[1].body:getPosition()
--            dump(fbag[val], '?? part_over:'..tostring(val)..':'..tostring(m))
        U.out.aset[1] = {set=U.map(fbag[val].av,function(k,v)
        local pos = amesh[1].body:getPosition()
--            dump(fbag[val], '?? part_over:'..tostring(val)..':'..tostring(m))
        U.out.aset[1] = {set=U.map(fbag[val].av,function(k,v)
        end
--            dump(bag4surf[val[1]][val[2]],'?? '..val[1]..':'..val[2]..':'..tostring(#m.faces))
        local flist = bag4surf[val[1]][val[2]]
    elseif key == 'mat_on' then
--            dump(daedata.dgeo,'?? mat_on:'..amat[val+1]..':'..tostring(cgeo),nil,2)
--            if true then return end
        omat:reload()
            lo('?? mat_on:'..tostring(env.ui['lod_up'])..':'..#amesh)
        local om = amesh[env.ui['lod_up']].body
            end
                lo('?? if_CGEO:'..cgeo..':'..tostring(daedata.dgeo[cgeo].name))
            if val>0 then
            M.space(am, cval[key].am, dir, val, 1, daedata)
--                lo('?? p_J:'..val..':'..#am..':'..tostring(amesh[1].data))
            if M.valid(am) then
        local m = daedata.dgeo[cgeo].m
           lo('?? geo_drag:'..tostring(cgeo)..':'..tostring(daedata.dgeo[cgeo])..':'..tostring(m))
        incontrol = true
        local m = daedata.dgeo[cgeo].m
           lo('?? geo_drag:'..tostring(cgeo)..':'..tostring(daedata.dgeo[cgeo])..':'..tostring(m))
        incontrol = true
        local m = daedata.dgeo[cgeo].m
           lo('?? geo_drag:'..tostring(cgeo)..':'..tostring(daedata.dgeo[cgeo])..':'..tostring(m))
        incontrol = true
                    if d.pos and d.pos:length()>0 then
                            lo('?? for_POS:'..tostring(d.pos))
                        for i,p in pairs(cval['DragPos'].m.verts) do
--        local am = amesh[1].data
--            lo('?? ext:'..tostring(amesh[1].dim)..':'..#am)
        local mesh = amesh[1]
            local mat = daedata.dgeo[m.key].mat
--                dump(mat.c,'?? for_DS:'..i..':'..ds..':'..tostring(m.key)..':'..tostring(mat.c)) --..(#am - 1)..':'..(i-(#am - 1)/2-1)) --..':'..ds)
--            colorOn(mat.body,{mat.c[1],mat.c[2],mat.c[3],0.5+0.5*math.abs(val/10)})
            local mat = daedata.dgeo[m.key].mat
--                dump(mat.c,'?? for_DS:'..i..':'..ds..':'..tostring(m.key)..':'..tostring(mat.c)) --..(#am - 1)..':'..(i-(#am - 1)/2-1)) --..':'..ds)
--            colorOn(mat.body,{mat.c[1],mat.c[2],mat.c[3],0.5+0.5*math.abs(val/10)})
                local key = ageopin[1]
                lo('?? beams_up:'..key..':'..#ageopin) --..':'..tostring(daedata.ageo[key].name))
--            local pos = amesh[1].body:getPosition()
                    end
                        lo('?? for_PART:'..tostring(d.name)..':'..#abeam)
                    if not beamdata.dbeam then beamdata.dbeam = {} end
            end
                lo('?? for_SEL_BEAMS:'..#abeam..':'..tostring(p1)..':'..tostring(p2))
--[[
            end
                lo('?? for_SEL_BEAMS:'..#abeam..':'..tostring(p1)..':'..tostring(p2))
--[[
                for i,b in pairs(abeam) do
    --                    lo('?? pp:'..i..':'..tostring(anode[b.av[1]].partOrigin)..':'..tostring(anode[b.av[2]].partOrigin))
                    if anode[b.av[1]].partOrigin == p1 and  anode[b.av[2]].partOrigin == p2
                for i,b in pairs(abeam) do
    --                    lo('?? pp:'..i..':'..tostring(anode[b.av[1]].partOrigin)..':'..tostring(anode[b.av[2]].partOrigin))
                    if anode[b.av[1]].partOrigin == p1 and  anode[b.av[2]].partOrigin == p2
            end
--                dump(beamdata.dbeam,'?? DMEAN:'..tostring(partname)..':'..#aobeam,nil,2)

--                lo('?? part_name:'..tostring(aobeam)..':'..tostring(partname)..':'..tostring(nm)..':'..tostring(key))
            if not beamdata.dbeam[partname] then

--                lo('?? part_name:'..tostring(aobeam)..':'..tostring(partname)..':'..tostring(nm)..':'..tostring(key))
            if not beamdata.dbeam[partname] then

--                lo('?? part_name:'..tostring(aobeam)..':'..tostring(partname)..':'..tostring(nm)..':'..tostring(key))
            if not beamdata.dbeam[partname] then

--                lo('?? part_name:'..tostring(aobeam)..':'..tostring(partname)..':'..tostring(nm)..':'..tostring(key))
            if not beamdata.dbeam[partname] then
            if not beamdata.dbeam[partname] then
                dump(beamdata.dbeam,'!! NO_PARTBEAMS:'..tostring(partname),nil,2)
                return
            end
--                dump(beamdata.dbeam,'?? part_name:'..tostring(aobeam)..':'..tostring(partname)..':'..tostring(nm)..':'..tostring(key),nil,2)
            local abeam = beamdata.dbeam[partname].list
            end
--                dump(beamdata.dbeam,'?? part_name:'..tostring(aobeam)..':'..tostring(partname)..':'..tostring(nm)..':'..tostring(key),nil,2)
            local abeam = beamdata.dbeam[partname].list
            end
--                dump(beamdata.dbeam,'?? part_name:'..tostring(aobeam)..':'..tostring(partname)..':'..tostring(nm)..':'..tostring(key),nil,2)
            local abeam = beamdata.dbeam[partname].list
            end
--                dump(beamdata.dbeam,'?? part_name:'..tostring(aobeam)..':'..tostring(partname)..':'..tostring(nm)..':'..tostring(key),nil,2)
            local abeam = beamdata.dbeam[partname].list
--                    daedata.dgeo[d.name].abeam = forBeams(ageopin[1])
                            lo('?? for_BEAMS:'..tostring(ageopin[1])..':'..#daedata.dgeo[d.key].abeam) --..tostring(ds))
                    -- {av={i1,i2},deform,strength,spring}
--                    daedata.dgeo[d.name].abeam = forBeams(ageopin[1])
                            lo('?? for_BEAMS:'..tostring(ageopin[1])..':'..#daedata.dgeo[d.key].abeam) --..tostring(ds))
                    -- {av={i1,i2},deform,strength,spring}
                _dbdrag = true
                    lo('?? for BD:'..tostring(daedata.dgeo[31].abeam))
                beamdata.m = daedata.dgeo[31].m
                beamdata.m = daedata.dgeo[31].m
--                lo('?? for_BEAMS:'..tostring(ageopin[1])..':'..tostring(amesh[1].body:getPosition()))
                local pvd = extensions.core_vehicle_manager.getPlayerVehicleData()
                beamdata.m = daedata.dgeo[31].m
--                lo('?? for_BEAMS:'..tostring(ageopin[1])..':'..tostring(amesh[1].body:getPosition()))
                local pvd = extensions.core_vehicle_manager.getPlayerVehicleData()
--        c = c/#daedata.dgeo[val].m.verts
            lo('?? mm:'..tostring(mi)..':'..tostring(ma)..':'..tostring(c))
        local sz = math.max(ma.x-mi.x,ma.y-mi.y,ma.z-mi.z)
--        c = c/#daedata.dgeo[val].m.verts
            lo('?? mm:'..tostring(mi)..':'..tostring(ma)..':'..tostring(c))
        local sz = math.max(ma.x-mi.x,ma.y-mi.y,ma.z-mi.z)
--        c = c/#daedata.dgeo[val].m.verts
            lo('?? mm:'..tostring(mi)..':'..tostring(ma)..':'..tostring(c))
        local sz = math.max(ma.x-mi.x,ma.y-mi.y,ma.z-mi.z)
            for j,f in pairs(flist.list) do
--                    lo('?? fo_F:'..tostring(f))
                af[#af+1] = pm[#pm].faces[f]
        end
--            dump(bag4surf,'?? b4s:'..tostring(bag4surf))
--            lo('?? geo_up:'..tostring(cgeo))
--            dump(bag4surf,'?? b4s:'..tostring(bag4surf))
--            lo('?? geo_up:'..tostring(cgeo))
--            bag4surf = {}
        daedata.ageo = dgeo
--            dump(dgeo, '?? for+DGEO:'..tostring(dgeo[1].mat.body..''),nil,3)
--[[
--            local reg = im.GetContentRegionAvail()
--            lo('?? dae_in:'..tostring(reg)..':'..im.GetWindowHeight())
        if not intodae then
        end
            lo('?? dae_in:'..cdaeHeight..':'..tostring(intodae)..':'..tostring(cpreview)..':'..tostring(#amesh)..':'..tostring(cobj)..':'..im.GetWindowHeight()..':'..tostring(cobj))
        if #amesh~=0 or not intodae then return end
        end
            lo('?? dae_in:'..cdaeHeight..':'..tostring(intodae)..':'..tostring(cpreview)..':'..tostring(#amesh)..':'..tostring(cobj)..':'..im.GetWindowHeight()..':'..tostring(cobj))
        if #amesh~=0 or not intodae then return end
        end
            lo('?? dae_in:'..cdaeHeight..':'..tostring(intodae)..':'..tostring(cpreview)..':'..tostring(#amesh)..':'..tostring(cobj)..':'..im.GetWindowHeight()..':'..tostring(cobj))
        if #amesh~=0 or not intodae then return end
        end
            lo('?? dae_in:'..cdaeHeight..':'..tostring(intodae)..':'..tostring(cpreview)..':'..tostring(#amesh)..':'..tostring(cobj)..':'..im.GetWindowHeight()..':'..tostring(cobj))
        if #amesh~=0 or not intodae then return end
        end
            lo('?? dae_in:'..cdaeHeight..':'..tostring(intodae)..':'..tostring(cpreview)..':'..tostring(#amesh)..':'..tostring(cobj)..':'..im.GetWindowHeight()..':'..tostring(cobj))
        if #amesh~=0 or not intodae then return end
            beamdata.anode = pvd.vdata.nodes
                lo('?? to_ghost:'..tostring(cpreview)..':'..tostring(cobj)..':'..tostring(scenetree.findObjectById(cobj):getPosition()))
            beamdata.ds = -pvd.vdata.nodes[pvd.vdata.refNodes[0].ref].pos -- + scenetree.findObjectById(cpreview):getPosition()
            beamdata.anode = pvd.vdata.nodes
                lo('?? to_ghost:'..tostring(cpreview)..':'..tostring(cobj)..':'..tostring(scenetree.findObjectById(cobj):getPosition()))
            beamdata.ds = -pvd.vdata.nodes[pvd.vdata.refNodes[0].ref].pos -- + scenetree.findObjectById(cpreview):getPosition()
            beamdata.anode = pvd.vdata.nodes
                lo('?? to_ghost:'..tostring(cpreview)..':'..tostring(cobj)..':'..tostring(scenetree.findObjectById(cobj):getPosition()))
            beamdata.ds = -pvd.vdata.nodes[pvd.vdata.refNodes[0].ref].pos -- + scenetree.findObjectById(cpreview):getPosition()
                for _,b in pairs(pvd.vdata.beams) do
--                    lo('?? for_beam:'..i..':'..tostring(b.partOrigin))
                    if string.find(b.partOrigin, 'pickup_radiator') then
            local alod = M.daeFrom(cpath)
                dump(alod[1], '?? if_LOD:'..tostring(#alod), nil, 2)
--                if true then return end
                    end
--                        dump(am[1],'?? if_VALID:'..k..':'..tostring(M.valid(am))..' s:'..s..' h:'..h)
                    if M.valid(am) then
            z = box.maxExtents.z - box.minExtents.z
                lo('?? VE:'..tostring(z))
        end
            local c = (box.minExtents+box.maxExtents)/2
                lo('?? exts_BOX:'..tostring(box.minExtents)..':'..tostring(box.maxExtents))
--            pos.z = z --amesh[1].body:getPosition().z
            local c = (box.minExtents+box.maxExtents)/2
                lo('?? exts_BOX:'..tostring(box.minExtents)..':'..tostring(box.maxExtents))
--            pos.z = z --amesh[1].body:getPosition().z
                for _,b in pairs(pvd.vdata.beams) do
--                    lo('?? for_beam:'..i..':'..tostring(b.partOrigin))
                    if string.find(b.partOrigin, 'pickup_radiator') then
            end
                lo('?? mm_BOX:'..tostring(mi)..':'..tostring(ma))
            beamdata.pos = (mi+ma)/2 --+ be:getObjectByID(pvd.id):getPosition()
            end
                lo('?? mm_BOX:'..tostring(mi)..':'..tostring(ma))
            beamdata.pos = (mi+ma)/2 --+ be:getObjectByID(pvd.id):getPosition()
            z = box.maxExtents.z - box.minExtents.z
                lo('?? VE:'..tostring(z))
        end
    elseif key == 'file_up' then
                lo('?? if_MESH:'..tostring(cpreview)..':'..tostring(val)..'/'..tostring(env.ui[key]))
        meshClear()
    elseif key == 'file_up' then
                lo('?? if_MESH:'..tostring(cpreview)..':'..tostring(val)..'/'..tostring(env.ui[key]))
        meshClear()
    elseif key == 'file_up' then
                lo('?? if_MESH:'..tostring(cpreview)..':'..tostring(val)..'/'..tostring(env.ui[key]))
        meshClear()
        local po = scenetree.findObject("thePlayer")
            lo('?? file_up:'..fsnode.path..':'..val..':'..tostring(po))
        if po then po.hidden = true end
            om.canSave = false
            om:registerObject(val) --'tmp_'..tostring(os.clock()))
            scenetree.findObject('edit'):add(om.obj)
                local amn = om:getMaterialNames()
--                lo('?? mat1:'..tostring(scenetree.findObject(amn[1]).obj))
                dump(amn, '?? mat_LIST:')
                dump(amn, '?? mat_LIST:')
--                dump(om:getMaterialNames(),'?? if_OM:'..tostring(om:getMeshMaterialNames()))
--                dump(om:getMeshMaterialNames(), '?? mnm:')
--                dump(om:getMeshMaterialNames(), '?? mnm:')
--                dump(om, '?? for_DAE:'..tostring(om.obj),nil, 2) --..':'..om.__parent)
        end
            local box = om:getWorldBox()
--                lo('?? mima_BOX:'..tostring(box.minExtents)..':'..tostring(box.maxExtents))
--            amesh[#amesh+1] = {id=id}
            local box = om:getWorldBox()
--                lo('?? mima_BOX:'..tostring(box.minExtents)..':'..tostring(box.maxExtents))
--            amesh[#amesh+1] = {id=id}
--        indae = true
--            dump(fsnode.afile, '?? cfile:'..tostring(fsnode.cfile)..':'..val)
    elseif key == 'fav_up' then
        local fout = io.open('/save/exp/favdir.json', "w")
            dump(fsnode.adir, '?? afav0:'..fsnode.path..':'..tostring(val))
        local pth = fsnode.path..fsnode.adir[val].s
        end
--            dump(fsnode.adir, '?? afav:'..pth) --..fsnode.path..':'..tostring(val))
            dump(afav, '?? afav:'..fsnode.path..':'..tostring(#ind))
--            dump(fsnode.adir, '?? afav:'..pth) --..fsnode.path..':'..tostring(val))
            dump(afav, '?? afav:'..fsnode.path..':'..tostring(#ind))
        U.toFile({list=afav,last=cpath}, {'save','exp'}, 'favdir.json')
        end)
--            lo('?? dir_up:'..tostring(ind)..':'..path..':'..tostring({unpack(fsnode.astep,1,ind[1])}))
        fsnode.path = path
        end)
--            lo('?? dir_up:'..tostring(ind)..':'..path..':'..tostring({unpack(fsnode.astep,1,ind[1])}))
        fsnode.path = path
    end
--        lo('?? me_GUI:'..tostring(W))
-- imgui.IsItemHovered()
                                if im.IsItemClicked() then --and k ~= env.ui['geo_up'] then
                                        lo('?? if_SEL:'..tostring(v.sel))
                                    v.sel = not v.sel
                                    inpin = W.onVal('geo_up', v.key) and v.key or nil
                                        lo('?? click_inpin:'..tostring(inpin))
                                    env.ui['geo_on'] = nil
                                if v.abeam then
--                                    im.Text(tostring(#v.abeam))
                                else
                            end, {3,20,5,4},{'','Part','Area',env.ui['model_on'] and (inmesh and '' or 'Beams') or 'Faces'},function(col,dir)
                                    lo('?? to_SORT:'..col..':'..dir..':'..tostring(daedata.ageo))
                                if daedata.ageo then
                                    if daedata.dgeo[v] then
                                        im.Text(tostring(daedata.dgeo[v].name))
                                    end
                                        im.tooltip((injoints and 'Skip' or 'Find')..' joint parts')
--                                        im.tooltip('CW:'..tostring(im.GetCursorPosX())..':'..tostring(im.GetColumnWidth()))
                                    end
                                        im.tooltip((injoints and 'Skip' or 'Find')..' joint parts')
--                                        im.tooltip('CW:'..tostring(im.GetCursorPosX())..':'..tostring(im.GetColumnWidth()))
                                    end
--                        elseif env.ui['geo_up'] then
--                            im.Text('TO_LINKS:'..tostring(env.ui['geo_up']))
--[[
                            im.SameLine()
                            im.tooltip('Show'..' links'..'>'..tostring(env.ui['geo_up'])..'<')
]]
                                    im.TableNextColumn()
                                    im.Text(tostring(#v.list))
                                    if im.IsItemHovered() then
                                for k,v in pairs(geonode.apart) do
                                    im.Text(daedata.dgeo[v] and tostring(daedata.dgeo[v].name) or 'NONE')
                                    if im.IsItemHovered() then
                                            U.out.aset[1] = {set=djoint[v],w=0.005}
--                                                lo('?? set_HOVER:'..tostring(inhover)..':'..tostring(env.ui['geo_on']))
                                        end
                                            U.out.aset[1] = {set=djoint[v],w=0.005}
--                                                lo('?? set_HOVER:'..tostring(inhover)..':'..tostring(env.ui['geo_on']))
                                        end
                                        end
--                                                lo('?? inhover:'..tostring(inhover)..'/'..tostring(env.ui['geo_on']))
                                    end
                                        end
--                                                lo('?? inhover:'..tostring(inhover)..'/'..tostring(env.ui['geo_on']))
                                    end
                                        im.TableNextColumn()
--                                            im.Text('ifp:'..k..':'..#env.ui['piece_up']..':'..tostring(#U.index(env.ui['piece_up'],k))..'<<')
                                        im.Text(U.index(apiece,k)[1] and ' * ' or '')
                                env.ui['piece_over'] = env.ui['on_piece']
--                                im.Text('?? PICES:'..tostring(env.ui['geo_up']))
--[[
                    if inhover ~= env.ui['geo_on'] and daedata.dgeo then
--                                lo('??***** PIN:'..tostring(inhover)..':'..#ageopin)
                        for c,d in pairs(daedata.dgeo) do
    --                                if true or inhover and inhover ~= env.ui['geo_on'] then
    --                                        lo('?? ifHOVER:'..tostring(inhover)..':'..tostring(env.ui['geo_list_over']))
                                        if d.name == inhover then
    --                                if true or inhover and inhover ~= env.ui['geo_on'] then
    --                                        lo('?? ifHOVER:'..tostring(inhover)..':'..tostring(env.ui['geo_list_over']))
                                        if d.name == inhover then
                                            elseif not onjpart or U.index(ageopin,d.key)[1] then
--                                                    dump(ageopin,'?? solid:'..d.key..':'..c..':'..d.name..':'..tostring(inhover))
                                                -- solid color
                                -- origonal color
--                                    dump(d.mat.c, '?? color_BACK:'..tostring(env.ui['geo_on'])..':'..tostring(inhover))
                                editor.setMaterialProperty(d.mat.body, 'translucent', 0, "1")
                                -- origonal color
--                                    dump(d.mat.c, '?? color_BACK:'..tostring(env.ui['geo_on'])..':'..tostring(inhover))
                                editor.setMaterialProperty(d.mat.body, 'translucent', 0, "1")
                        end
--                            dump(geonode.astep, '?? forGAS:'..tostring(inhover)..':'..tostring(env.ui['geo_on']))
                        if geonode.astep then
                        end
--                            dump(geonode.astep, '?? forGAS:'..tostring(inhover)..':'..tostring(env.ui['geo_on']))
                        if geonode.astep then
                                end
--                                    dump(d.mat.c,'?? for_COLOR:'..k..':'..tostring(d.name))
                            end
                                    colorOn(d.mat.body,d.mat.c)
    --                                    dump(d.mat.c,'?? for_COLOR:'..k..':'..tostring(d.name))
                                end
                                colorOn(d.mat.body,d.mat.c)
--                                    dump(d.mat.c,'?? for_COLOR:'..k..':'..tostring(d.name))
                            end
--            color = (env.ui['lod_up'] and env.ui['lod_up']>0) and
--                lo('?? for_CLR:'..tostring(color)..':'..tostring(env.ui['lod_up']))
--            im.SetCursorPosY(im.GetCursorPosY()+4)
--            color = (env.ui['lod_up'] and env.ui['lod_up']>0) and
--                lo('?? for_CLR:'..tostring(color)..':'..tostring(env.ui['lod_up']))
--            im.SetCursorPosY(im.GetCursorPosY()+4)
            UI.buttonImg('dae_out', 'floppyDisk', {34,34}, color)
            im.tooltip('To DAE') --?? LU:'..tostring(env.ui['lod_up']))
--                im.tooltip('Explore '..(indae and 'files' or 'mesh'))
--                im.tooltip('File explorer'..tostring(indae)..':'..tostring(color))
            end
--                im.tooltip('Explore '..(indae and 'files' or 'mesh'))
--                im.tooltip('File explorer'..tostring(indae)..':'..tostring(color))
            end
                            im.TableNextColumn()
--                                im.Text('MU:'..tostring(env.ui['model_up']))
                            im.Text(v)
    --                    im.Text(fsnode.adir[i])
    --                        lo('?? for_DIR:'..tostring(fsnode.adir[i]))
                            UI.buttonTxt('dir_in', fsnode.adir[i].s)
            -- goto file for groups
                lo('?? fof:'..tostring(beamdata.cpart.name))
]]
    ]]
    --                dump(mat.c,'?? for_DS:'..i..':'..ds..':'..tostring(m.key)..':'..tostring(mat.c)) --..(#am - 1)..':'..(i-(#am - 1)/2-1)) --..':'..ds)
    --            colorOn(mat.body,{mat.c[1],mat.c[2],mat.c[3],0.5+0.5*math.abs(val/10)})
    ]]
    --                dump(mat.c,'?? for_DS:'..i..':'..ds..':'..tostring(m.key)..':'..tostring(mat.c)) --..(#am - 1)..':'..(i-(#am - 1)/2-1)) --..':'..ds)
    --            colorOn(mat.body,{mat.c[1],mat.c[2],mat.c[3],0.5+0.5*math.abs(val/10)})
        if inbeams == 2 then
--                dump(beamdata.abeam,'?? inbeams:'..tostring(inbeams),nil,2)
        end
            if env.ui['group_over'] then
                    lo('?? to_BEAMS2:'..tostring(cpreview))
                -- restore basic highlight
    if im.IsKeyPressed(im.Key_ModShift) then
--            lo('?? shiftL:'..#ageopin..':'..tostring(inbeams))
        if #ageopin>0 or apart == 2 and not inbeams then
        if #ageopin>0 or apart == 2 and not inbeams then
--                lo('?? if_BU:'..tostring(env.ui['cbeam'])..':'..tostring(ageopin[1]))
            if env.ui['cbeam'] ~= ageopin[1] and env.ui['model_on'] then
        if #ageopin>0 or apart == 2 and not inbeams then
--                lo('?? if_BU:'..tostring(env.ui['cbeam'])..':'..tostring(ageopin[1]))
            if env.ui['cbeam'] ~= ageopin[1] and env.ui['model_on'] then
                    for id, veh in activeVehiclesIterator() do
                        lo('?? for_VEH:'..tostring(veh:getId()))
                        local om = scenetree.findObjectById(veh:getId())
                        local om = scenetree.findObjectById(veh:getId())
                        lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
                        if om then om:delete() end
                        local om = scenetree.findObjectById(veh:getId())
                        lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
                        if om then om:delete() end
--                    local po = scenetree.findObject("thePlayer")
--                    lo('?? if_PO:'..tostring(po.id)..':'..tostring(po:getId()))
--                    local om = scenetree.findObjectById(po:getId())
--                    local po = scenetree.findObject("thePlayer")
--                    lo('?? if_PO:'..tostring(po.id)..':'..tostring(po:getId()))
--                    local om = scenetree.findObjectById(po:getId())
--                    local om = scenetree.findObjectById(po:getId())
--                    lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
--                    if om then om:delete() end
--                    local om = scenetree.findObjectById(po:getId())
--                    lo('?? if_PREV:'..tostring(cpreview)..':'..tostring(om))
--                    if om then om:delete() end
            end
                lo('?? part_name:'..tostring(aobeam)..':'..tostring(partname)) --..':'..tostring(nm)..':'..tostring(key))
            end
                lo('?? part_name:'..tostring(aobeam)..':'..tostring(partname)) --..':'..tostring(nm)..':'..tostring(key))
            end
                lo('?? part_name:'..tostring(aobeam)..':'..tostring(partname)) --..':'..tostring(nm)..':'..tostring(key))
            end
                lo('?? part_name:'..tostring(aobeam)..':'..tostring(partname)) --..':'..tostring(nm)..':'..tostring(key))
]]
                lo('?? if_pick:'..tostring(env.ui['jpart_pick']))
            local partname
            end
--                lo('?? if_pick2:'..tostring(ajpart[env.ui['jpart_pick']].name)..':'..tostring(partname))
--                partname = 'pickup_hood'
            end
--                lo('?? if_pick2:'..tostring(ajpart[env.ui['jpart_pick']].name)..':'..tostring(partname))
--                partname = 'pickup_hood'
    elseif im.IsKeyReleased(im.Key_ModShift) then
            lo('?? BB:'..tostring(inbeams)..':'..tostring(_conf.camSpeed))
        core_camera.setSpeed(_conf.camSpeed)
    elseif im.IsKeyReleased(im.Key_ModShift) then
            lo('?? BB:'..tostring(inbeams)..':'..tostring(_conf.camSpeed))
        core_camera.setSpeed(_conf.camSpeed)
--            local eu = core_camera.getQuat():toEulerYXZ()
--                lo('?? forEU:'..tostring(eu))
            meshTarget.N = 100
            camTarget.crot = quatFromDir(core_camera.getForward()) --core_camera.getQuat()
--                lo('??++++++++++++ to_DIR:'..tostring(camTarget.dir)..':'..tostring(camTarget.crot)..':'..tostring(quatFromDir(core_camera.getForward())))
--            local eu = core_camera.getQuat():toEulerYXZ()
            camTarget.crot = quatFromDir(core_camera.getForward()) --core_camera.getQuat()
--                lo('??++++++++++++ to_DIR:'..tostring(camTarget.dir)..':'..tostring(camTarget.crot)..':'..tostring(quatFromDir(core_camera.getForward())))
--            local eu = core_camera.getQuat():toEulerYXZ()
            camTarget.crot = quatFromDir(core_camera.getForward()) --core_camera.getQuat()
--                lo('??++++++++++++ to_DIR:'..tostring(camTarget.dir)..':'..tostring(camTarget.crot)..':'..tostring(quatFromDir(core_camera.getForward())))
--            local eu = core_camera.getQuat():toEulerYXZ()
--            local eu = core_camera.getQuat():toEulerYXZ()
--                lo('?? forEU:'..tostring(eu))
            camTarget.N = 50
        local q = camTarget.crot*(1-t)+quatFromDir(camTarget.dir)*t
--            lo('?? for_q:'..tostring(camTarget.crot)..'>'..tostring(q))
        core_camera.setRotation(0,q)
        local q = camTarget.crot*(1-t)+quatFromDir(camTarget.dir)*t
--            lo('?? for_q:'..tostring(camTarget.crot)..'>'..tostring(q))
        core_camera.setRotation(0,q)
--        if #ageopin>0 then
--            lo('?? for_SHIFT:'..#ageopin..':'..tostring(env.ui['cbeam'])..':'..tostring(ageopin[1]))
--[[
--        if #ageopin>0 then
--            lo('?? for_SHIFT:'..#ageopin..':'..tostring(env.ui['cbeam'])..':'..tostring(ageopin[1]))
--[[
]]
--                lo('?? ifBEAMS:'..tostring(ageopin[1]))
--            dump(beamdata.dbeam,'?? if_BEAMS:'..tostring(ageopin[1])) --..':'..tostring(beamdata.dbeam[ageopin[1]]))
--                lo('?? ifBEAMS:'..tostring(ageopin[1]))
--            dump(beamdata.dbeam,'?? if_BEAMS:'..tostring(ageopin[1])) --..':'..tostring(beamdata.dbeam[ageopin[1]]))
--            U.out.agraph[1] = {list=forBeams(ageopin[1]), c={1,1,0,0.6}, w=2, z=false}
--                lo('?? ifBEAMS:'..tostring(ageopin[1]))
--            dump(beamdata.dbeam,'?? if_BEAMS:'..tostring(ageopin[1])) --..':'..tostring(beamdata.dbeam[ageopin[1]]))
--            U.out.agraph[1] = {list=forBeams(ageopin[1]), c={1,1,0,0.6}, w=2, z=false}
                        cm = cm/#daedata.dgeo[key].m.verts
    --                        dump(daedata.dgeo[key].m.verts, '?? for_D:'..tostring(cm))
    --                    dump(d.abeam,'?? for_BM:'..tostring(#d.abeam))
    --                        dump(daedata.dgeo[key].m.verts, '?? for_D:'..tostring(cm))
    --                    dump(d.abeam,'?? for_BM:'..tostring(#d.abeam))
                        local cb = vec3(0,0,0)
                    if not daedata.dgeo[d.key].abeam then
--                            lo('?? for_BEAMS:'..tostring(ds))
                        daedata.dgeo[d.key].abeam = forBeams(ageopin[1])
                    end
                        lo('?? cc:'..tostring(cm)..'/'..tostring(cb)..':'..tostring(ds))
                    local apath = U.map(d.abeam,function(k,v)
                    end
                        lo('?? cc:'..tostring(cm)..'/'..tostring(cb)..':'..tostring(ds))
                    local apath = U.map(d.abeam,function(k,v)
                    end
                        lo('?? cc:'..tostring(cm)..'/'..tostring(cb)..':'..tostring(ds))
                    local apath = U.map(d.abeam,function(k,v)
                    for i,list in pairs(bag4surf) do
--                        im.Text(tostring(cgeo))
                        im.Text(toroman[i])
                                    inpin = W.onVal('geo_up', v.key) and v.key or nil
                                        lo('?? click_inpin:'..tostring(inpin))
                                    env.ui['geo_on'] = nil
                                if v.abeam then
                                    im.Text(tostring(#v.abeam))
                                end
                        if inhover ~= env.ui['geo_on'] then
                                    lo('??***** PIN:'..tostring(inhover)..':'..#ageopin)
                            for c,d in pairs(daedata.dgeo) do
        --                                if true or inhover and inhover ~= env.ui['geo_on'] then
        --                                        lo('?? ifHOVER:'..tostring(inhover)..':'..tostring(env.ui['geo_list_over']))
                                            if c == inhover or U.index(ageopin,c)[1] then
        --                                if true or inhover and inhover ~= env.ui['geo_on'] then
        --                                        lo('?? ifHOVER:'..tostring(inhover)..':'..tostring(env.ui['geo_list_over']))
                                            if c == inhover or U.index(ageopin,c)[1] then
    --                            cbg[4] = 0.2
                                im.Text(tostring(v.name)..' / '..#v.m.verts..' /')
    --                            im.Text(k..' / '..#v.m.verts..' /')
                                        if inhover == c then
--                                                dump(d.mat.c,'?? for_MAT:'..tostring(c)..':'..tostring(#d.m.verts))
                                            editor.setMaterialProperty(d.mat.body, 'translucent', 0, "0")
                                        if inhover == c then
--                                                dump(d.mat.c,'?? for_MAT:'..tostring(c)..':'..tostring(#d.m.verts))
                                            editor.setMaterialProperty(d.mat.body, 'translucent', 0, "0")
                                        else
--                                                lo('?? no_MAT:'..c..':'..tostring(inhover))
                                            editor.setMaterialProperty(d.mat.body, 'translucent', 0, "1")
@/lua/ge/extensions/campaign/campaignsLoader.lua
  --log('D', logTag, 'splitFieldByToken called...')
  --log('D', logTag, 'field: '..tostring(field))
  --log('D', logTag, 'token: '..tostring(token))
  --log('D', logTag, 'field: '..tostring(field))
  --log('D', logTag, 'token: '..tostring(token))
    local campaignSaveFilename = campaign_campaignsLoader.checkSaveExists(processedCampaign.meta.title, processedCampaign.meta.enableSaves)
    --log('I', logTag, 'Found saved campaign: '..tostring(campaignSaveFilename))
local function checkSaveExists(title, savesEnabled)
  --log('I', logTag, 'checkSaveExists called....Title: '..title..' savesEnabled: '..tostring(savesEnabled))
local function saveCampaign(campaign)
  log('I', logTag, 'saving campaign json file: '..tostring(campaign.meta.enableSaves))
@/lua/ge/extensions/gameplay/rally/snaproad.lua
  --   for i,pt in ipairs(p) do
  --     s = s..', '..tostring(pt.id)
  --   end
@/lua/vehicle/controller/vehicleController/shiftLogic/cvtGearbox2.lua
  end
  return modePrefix ~= "" and modePrefix .. tostring(cvtHandling.fixedGearRatioIndex) or automaticHandling.mode
end
        for j = 1, gearbox.maxGearIndex, 1 do
          local manualMode = "M" .. tostring(j)
          local manualModeIndex = i + j - 1
      if type(v) ~= "number" then
        log("W", "cvtGearbox2", "Invalid value #" .. tostring(i) .. " for fixedGearRatios (value was not a number)")
        break
      if #cvtHandling.fixedGearRatios > 0 and v >= cvtHandling.fixedGearRatios[#cvtHandling.fixedGearRatios] then
        log("W", "cvtGearbox2", "Invalid value #" .. tostring(i) .. " for fixedGearRatios (gear ratio must be smaller than the last)")
        break
@/lua/ge/extensions/util/compileMeshes.lua
  if cacheDir then
    log('I', 'work', '*** Using cache folder: ' .. tostring(cacheDir))
    if not FS:directoryExists(cacheDir) then
    if not FS:directoryCreate(cacheDir, true) then
      log('E', 'work', '*** Unable to create cache folder: ' .. tostring(cacheDir))
    end

      --log('D', 'work', '*** Converting collada files in path: ' .. tostring(dir))
      local recursiveLevels =-1
          cacheFilename = cacheDir .. '/' .. src_hash .. '.cdae'
          --print('cacheFilename = ' .. tostring(cacheFilename) .. ' / ' .. tostring(FS:fileExists(cacheFilename)))
          if FS:fileExists(cacheFilename) then
          cacheFilename = cacheDir .. '/' .. src_hash .. '.cdae'
          --print('cacheFilename = ' .. tostring(cacheFilename) .. ' / ' .. tostring(FS:fileExists(cacheFilename)))
          if FS:fileExists(cacheFilename) then
                if FS:copyFile(dst, cacheFilename) ~= 0 then
                  log('E', 'work', '*** error copying file to cache: ' .. tostring(cacheFilename))
                else
        if log_progress_timer:stop() > 3000 then
          log('A', '', 'progress: file ' .. fileCountDone .. ' / ' .. fileCount .. ' ( ' .. round((fileCountDone/fileCount)*100) .. '% ) - ' .. tostring(cacheMisses) .. ' misses / '.. tostring(cacheHits) .. ' hits')
          log_progress_timer:reset()
        if log_progress_timer:stop() > 3000 then
          log('A', '', 'progress: file ' .. fileCountDone .. ' / ' .. fileCount .. ' ( ' .. round((fileCountDone/fileCount)*100) .. '% ) - ' .. tostring(cacheMisses) .. ' misses / '.. tostring(cacheHits) .. ' hits')
          log_progress_timer:reset()
      if not compiledFiles[f] and not isPathIgnored(f) then
        log('E', 'work', '--- Missed compilation of file: ' .. tostring(f))
        exitCode = 1

  log('I', 'work', ' *** done: ' .. fileCount .. ' files (' .. tostring(missedFiles) .. ' missed) ' .. tostring(cacheHits) .. ' cache hits (' .. round((cacheHits/(cacheHits + cacheMisses))*100) .. '%) and ' .. tostring(cacheMisses) .. ' cache misses.')

  log('I', 'work', ' *** done: ' .. fileCount .. ' files (' .. tostring(missedFiles) .. ' missed) ' .. tostring(cacheHits) .. ' cache hits (' .. round((cacheHits/(cacheHits + cacheMisses))*100) .. '%) and ' .. tostring(cacheMisses) .. ' cache misses.')

  log('I', 'work', ' *** done: ' .. fileCount .. ' files (' .. tostring(missedFiles) .. ' missed) ' .. tostring(cacheHits) .. ' cache hits (' .. round((cacheHits/(cacheHits + cacheMisses))*100) .. '%) and ' .. tostring(cacheMisses) .. ' cache misses.')

  log('D', 'work', 'Script done. Exit code: ' .. tostring(exitCode))
@/lua/ge/extensions/editor/gen/lib/ui.lua
		env.onVal(key, txt)
--          lo('?? ui.buttonT.matsel:'..tostring(W.out.curselect))
	end
--  count_inp = count_inp + 1
--  local clbl = tostring(count_inp)
  if im.Checkbox("##" .. lbl, ptr) then
--    lo('?? check:'..tostring(ptr[0])..':'..tostring(env))
  	env.onVal(key, ptr[0])
  if im.Checkbox("##" .. lbl, ptr) then
--    lo('?? check:'..tostring(ptr[0])..':'..tostring(env))
  	env.onVal(key, ptr[0])
		count_inp = count_inp + 1
		lbl = tostring(count_inp)
	end
--  count_inp = count_inp + 1
--  local clbl = tostring(count_inp)
  if im.Checkbox("##" .. lbl, ptr) then
--    lo('?? check:'..tostring(ptr[0])..':'..tostring(env))
  	env.onVal(key, ptr[0])
  if im.Checkbox("##" .. lbl, ptr) then
--    lo('?? check:'..tostring(ptr[0])..':'..tostring(env))
  	env.onVal(key, ptr[0])
--            lo('?? combo:'..lbl..':'..key..':'..isel)
--            lo('?? seld:'..tostring(o))
		env.onVal(key, o)
                local ind = im.TableGetColumnIndex()
                    lo('?? ci:'..tostring(ind)..':'..tostring(im.TableGetSortSpecs().Specs.SortDirection))
--            table.sort(data, getSortingFunction(im.TableGetSortSpecs().Specs.ColumnIndex))
                local ind = im.TableGetColumnIndex()
                    lo('?? ci:'..tostring(ind)..':'..tostring(im.TableGetSortSpecs().Specs.SortDirection))
--            table.sort(data, getSortingFunction(im.TableGetSortSpecs().Specs.ColumnIndex))
--            table.sort(data, getSortingFunction(im.TableGetSortSpecs().Specs.ColumnIndex))
--            lo('?? hCLICK:'..tostring(im.TableGetSortSpecs().Specs.SortDirection)..':'..tostring(im.TableGetSortSpecs().Specs.ColumnIndex))
                if im.TableGetSortSpecs().Specs.ColumnIndex then
--            table.sort(data, getSortingFunction(im.TableGetSortSpecs().Specs.ColumnIndex))
--            lo('?? hCLICK:'..tostring(im.TableGetSortSpecs().Specs.SortDirection)..':'..tostring(im.TableGetSortSpecs().Specs.ColumnIndex))
                if im.TableGetSortSpecs().Specs.ColumnIndex then
            local col = im.TableGetSortSpecs().Specs[1].ColumnIndex + 1
--                lo('?? to_SORT:'..tostring(im.TableGetSortSpecs().Specs[1].ColumnName)..':'..tostring(im.TableGetSortSpecs().Specs[1].SortDirection))
            if cbsort then
            local col = im.TableGetSortSpecs().Specs[1].ColumnIndex + 1
--                lo('?? to_SORT:'..tostring(im.TableGetSortSpecs().Specs[1].ColumnName)..':'..tostring(im.TableGetSortSpecs().Specs[1].SortDirection))
            if cbsort then
--            local ind = im.TableGetColumnIndex()
--                lo('?? ci:'..tostring(ind)..':'..tostring(im.TableGetSortSpecs().Specs.SortDirection)..':'..tostring(im.TableGetSortSpecs().Specs[1].ColumnIndex))
--            table.sort(data, getSortingFunction(im.TableGetSortSpecs().Specs.ColumnIndex))
--            local ind = im.TableGetColumnIndex()
--                lo('?? ci:'..tostring(ind)..':'..tostring(im.TableGetSortSpecs().Specs.SortDirection)..':'..tostring(im.TableGetSortSpecs().Specs[1].ColumnIndex))
--            table.sort(data, getSortingFunction(im.TableGetSortSpecs().Specs.ColumnIndex))
--            local ind = im.TableGetColumnIndex()
--                lo('?? ci:'..tostring(ind)..':'..tostring(im.TableGetSortSpecs().Specs.SortDirection)..':'..tostring(im.TableGetSortSpecs().Specs[1].ColumnIndex))
--            table.sort(data, getSortingFunction(im.TableGetSortSpecs().Specs.ColumnIndex))
--            table.sort(data, getSortingFunction(im.TableGetSortSpecs().Specs.ColumnIndex))
--            lo('?? hCLICK:'..tostring(im.TableGetSortSpecs().Specs.SortDirection)..':'..tostring(im.TableGetSortSpecs().Specs.ColumnIndex))
--[[
--            table.sort(data, getSortingFunction(im.TableGetSortSpecs().Specs.ColumnIndex))
--            lo('?? hCLICK:'..tostring(im.TableGetSortSpecs().Specs.SortDirection)..':'..tostring(im.TableGetSortSpecs().Specs.ColumnIndex))
--[[
@/lua/ge/extensions/core/vehicle/partmgmt.lua
  if not vehicle or not vehicleData then
    log('E', 'partmgmt', 'vehicle ' .. tostring(vehId) .. ' not found')
    return
      if not veh then
        log('E', 'partmgmt', 'vehicle not found for entry: ' .. tostring(entry.vehId))
        return
      if not parentVeh then
        log('E', 'partmgmt', 'parent vehicle not found for entry: ' .. tostring(entry.vehId))
        return
        else
          --log('W', '', 'part not highlighted: ' .. tostring(flexbody.partPath))
        end
        else
          --log('W', '', 'part not highlighted: ' .. tostring(prop.partPath))
        end
@/lua/ge/extensions/ui/apps.lua
      else
        log('E', 'apps', 'invalid app data:' .. tostring(fn) .. ': missing "domElement" or "directive" in app.json - IGNORING APP: ' .. dumps(appData))
      end
    else
      log('E', 'apps', 'unable to read app from dir:' .. tostring(fn))
    end
  jsonWriteFile(filename, data, true)
  --dump({'saved layout: ' .. tostring(filename), data})
  requestUIAppsData()
      if not isOfficialContentVPath(layout.filename) then
        log('I', '', 'deleting layout: ' .. tostring(layout.filename))
        FS:removeFile(layout.filename)
      else
        log('I', '', 'will not delete file as it is part of the official content distribution: ' .. tostring(layout.filename))
        requestUIAppsData()
  end
  log('E', '', 'unable to delete layout - file not found: ' .. tostring(filenameToDelete))
end
@/lua/ge/extensions/editor/meshSpline.lua
          local flag = i == selectedSplineIdx
          if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            selectedSplineIdx = i
          else
            if im.InputText("###" .. tostring(wCtr), splineNamePtr, 32) then
              spline.name = ffi.string(splineNamePtr)
@/lua/ge/extensions/editor/aiTests.lua
      if string.find(marker.objectName, "Waypoint") then
        marker.objectName = "Waypoint #"..tostring(i - 1)
      end
@/lua/ge/extensions/gameplay/rally.lua
    -- else
    --   if debugLogging then log('D', logTag, string.format('onRacePathnodeReached name=%s split=%s', pathnode.name, tostring(pathnode.useAsSplit))) end
    -- end
--   local resetBudgetNonStage = settings.getValue('rallyLoopResetBudgetNonStage')
--   log('W', logTag, 'onRallyVehicleRecovery type='..tostring(recoveryType))
-- end
@/lua/ge/extensions/editor/tech/roadArchitect/groups.lua
    local gIdx = #groups + 1
    groups[gIdx] = { name = 'User ' .. tostring(gIdx), roads = roadArray }
  end
    local gIdx = #groups + 1
    local gName = (name or 'User ') .. tostring(gIdx)
    groups[gIdx] = { name = gName, roads = gRoads }
@/lua/ge/extensions/editor/gen/region.lua
	if not across[ri] or not across[ri][ni] then return end
--        lo('?? for_crn:'..tostring(across[ri][ni]))
	local astem,us = U.clone(across[ri][ni])
			local base = U.clone(abase[i])
--                    lo('?? for_i:'..i..':'..tostring(abound[i])..':'..#abase)
			if true and abound[i] then
				local s = closestLinePoints(a, b, p, p + vec3(0,0,1))
--                        lo('?? for_s:'..i..':'..j..':'..tostring(s)..'<'..tostring(spre))
				if 0 <= s and s < 1 then
				local s = closestLinePoints(a, b, p, p + vec3(0,0,1))
--                        lo('?? for_s:'..i..':'..j..':'..tostring(s)..'<'..tostring(spre))
				if 0 <= s and s < 1 then
				if 0 <= s and s < 1 then
--                        lo('??- for_s2:'..tostring(spre))
					cdp = p:distanceToLine(a, b)
						cda = cdp
--                        lo('??-- for_s21:'..tostring(cda)..':'..tostring(da))
						if not da or cda < da then da = cda end
						cda = cdp
--                        lo('??-- for_s21:'..tostring(cda)..':'..tostring(da))
						if not da or cda < da then da = cda end
						cda = ((ppre*s - p*spre)/(s-spre) - a):length()
--                        lo('??-- for_s22:'..tostring(cda)..':'..tostring(da))
						if not da or cda < da then da = cda end
						cda = ((ppre*s - p*spre)/(s-spre) - a):length()
--                        lo('??-- for_s22:'..tostring(cda)..':'..tostring(da))
						if not da or cda < da then da = cda end
					end
--                        lo('?? da_cdp:'..tostring(da)..':'..tostring(spre))
					da = math.min(da,cdp)
					end
--                        lo('?? da_cdp:'..tostring(da)..':'..tostring(spre))
					da = math.min(da,cdp)
				if s > 1 then
--                    lo('??- for_s3:'..tostring(spre))
					if spre then
							cda = ((ppre*s - p*spre)/(s-spre) - a):length()
--                            lo('??-- for_s31:'..tostring(cda))
							if not da or cda < da then da = cda end
						cdb = ((ppre*(s-1) + p*(1-spre))/(s-spre) - b):length()
--                            lo('??-- for_s32:'..i..':'..j..':'..tostring(cdb))
--                            out.acyan = {p}
		end
--            U.dump(push, '?? pre_ret: da:'..tostring(da)..' db:'..tostring(db))
		if not da then da = math.huge end
		end
--            U.dump(push, '?? pre_ret: da:'..tostring(da)..' db:'..tostring(db))
		if not da then da = math.huge end
	local d = forCross(a,b,1)
--    lo('<< forDepth:'..tostring(d))
local function p2side(p, side, start, dbg)
--        U.dump(side, '>> p2side:'..tostring(p)..':'..start)
	if not start then start = side.fr end
				end
--            lo('?? p2side:'..tostring(ni)..':'..tostring(pos))
		if pos == -1 then
				end
--            lo('?? p2side:'..tostring(ni)..':'..tostring(pos))
		if pos == -1 then
	local ni = side.to
--        lo('?? for_NI:'..ni..tostring(anode[ni])..':'..tostring(vp))
	if vp then
	local ni = side.to
--        lo('?? for_NI:'..ni..tostring(anode[ni])..':'..tostring(vp))
	if vp then
--    local ano = anobj
--        lo('?? for_ano2:'..tostring(ano)..':'..tostring(side))
	if not anobj and side then
--    local ano = anobj
--        lo('?? for_ano2:'..tostring(ano)..':'..tostring(side))
	if not anobj and side then
		ano = editor.getNodes(scenetree.findObjectById(adec[side.rd].id))
--        lo('?? for_ano:'..tostring(ano))
	end
	acLen[#acLen + 1] = L
		U.dump(side, '>>--------------- seed: L='..tostring(L)..' dma:'..tostring(dma)..':'..tostring(tp)..' nbase:'..#abase..' nside:'..#aswitch..':'..#base..':'..tostring(_DBG))
--        lo('?? for_length:'..tostring(dn2d[side.rd][side.dir>0 and side.to or side.fr].d))
	acLen[#acLen + 1] = L
		U.dump(side, '>>--------------- seed: L='..tostring(L)..' dma:'..tostring(dma)..':'..tostring(tp)..' nbase:'..#abase..' nside:'..#aswitch..':'..#base..':'..tostring(_DBG))
--        lo('?? for_length:'..tostring(dn2d[side.rd][side.dir>0 and side.to or side.fr].d))
	acLen[#acLen + 1] = L
		U.dump(side, '>>--------------- seed: L='..tostring(L)..' dma:'..tostring(dma)..':'..tostring(tp)..' nbase:'..#abase..' nside:'..#aswitch..':'..#base..':'..tostring(_DBG))
--        lo('?? for_length:'..tostring(dn2d[side.rd][side.dir>0 and side.to or side.fr].d))
	acLen[#acLen + 1] = L
		U.dump(side, '>>--------------- seed: L='..tostring(L)..' dma:'..tostring(dma)..':'..tostring(tp)..' nbase:'..#abase..' nside:'..#aswitch..':'..#base..':'..tostring(_DBG))
--        lo('?? for_length:'..tostring(dn2d[side.rd][side.dir>0 and side.to or side.fr].d))
		U.dump(side, '>>--------------- seed: L='..tostring(L)..' dma:'..tostring(dma)..':'..tostring(tp)..' nbase:'..#abase..' nside:'..#aswitch..':'..#base..':'..tostring(_DBG))
--        lo('?? for_length:'..tostring(dn2d[side.rd][side.dir>0 and side.to or side.fr].d))
--        lo('?? for_seed:'..)
				--            if #abase == 5 then
	--            lo('?? for_s:'..tostring(s)..'/'..tostring(spre)..' ni:'..ni)
				--            end
				--            if #abase == 5 then
	--            lo('?? for_s:'..tostring(s)..'/'..tostring(spre)..' ni:'..ni)
				--            end
	--                if pfr then
	--                    lo('?? for_last:'..L..':'..ni..':'..(ni-side.dir)..':'..(last + side.dir*n2d[ni].d)..'/'..(dfr + L)..':'..tostring(dfr))
	--                end
			depthma = forDepth(base[#base-1],base[#base]) --, true)
--                U.dump(base, '?? for_DEPTH:'..tostring(depthma)..':'..sideWidth(side, ni))
--                out.acyan = {base[#base-1], base[#base]}
	end
--    lo('?? depthma:'..tostring(depthma))
			local prd,ni,s = p2side(p, side)
--                    U.dump(side, '?? for_p:'..i..':'..j..':'..tostring(p)..':'..(p - prd):length()..'/'..d)
			if (p - prd):length() > d then
				agreen[#agreen + 1] = {s = dpre, p = ppre}
--                    lo('?? for_green:'..i..':'..j..':'..#agreen..':'..tostring(ppre))
				if not ppre then
			else
--                    lo('?? for_red:'..i..':'..j..':'..tostring(ppre))
				agreen = {}
--[[
		lo('?? fromDepth:'..tostring(pa))
	if pa then
		local dma = distOnSide(pa, side)
			lo('?? dist:'..tostring(dma))
		local prd = p2side(pa, side)
--    for i = #abase,1,-1 do
--                lo('?? for_base:'..i..':'..#abase[i]..':'..tostring(tonext))
		if tonext and (tonext - i)/parity < 0 then
			else --if corner then
--                    lo('?? for_green:'.._..':'..ni..':'..s..':'..tostring(corner)..' d:'..def..' dpre:'..tostring(defpre))
--                local last = side.dir < 0 and n2d[side.fr].d or 0
			else --if corner then
--                    lo('?? for_green:'.._..':'..ni..':'..s..':'..tostring(corner)..' d:'..def..' dpre:'..tostring(defpre))
--                local last = side.dir < 0 and n2d[side.fr].d or 0
	--                    out.awhite = {corner}
	--                        lo('?? for_w:'..ni..':'..tostring(sideWidth(side, ni)))
					corner = corner + U.proj2D(p - prd):normalized()*sideWidth(side, ni)
					if parity == -1 then
							U.dump(side, '?? preDIST:'..tostring(corner)..':'..ni..':'..(ni-side.dir))
						if ni == side.fr then --and s == 1 then
	--                dir = (prd - ppre):dot(v) > 0 and 1 or -1
	--                    U.dump(side, '?? for_CORNER:'..tostring(ni)..':'..side.dir..':'..s)
	--                    out.acyan = {corner}
	--                    out.acyan = {corner}
						lo('<< sidePush:'..nipre..'>'..ni..':'..tostring(dma))
					return corner, parity*v:normalized(), dma, (p-ptpre):normalized()
--            out.acyan = {ppre,pa}
			lo('?? for_C:'..tostring(corner)..':'..tostring(pa)..':'..tostring(ppre))
		corner = corner + (pa - ppre):normalized()*sideWidth(side, nipre)
--            out.acyan = {ppre,pa}
			lo('?? for_C:'..tostring(corner)..':'..tostring(pa)..':'..tostring(ppre))
		corner = corner + (pa - ppre):normalized()*sideWidth(side, nipre)
--            out.acyan = {ppre,pa}
			lo('?? for_C:'..tostring(corner)..':'..tostring(pa)..':'..tostring(ppre))
		corner = corner + (pa - ppre):normalized()*sideWidth(side, nipre)
		local prd,ni,s = p2side(p, side, side.fr) --, nj == 1 and true or false)
--                lo('?? for_prd:'..nj..':'..tostring(prd)..':'..tostring(ni)..':'..tostring(s))
--                        lo('?? for_node:'..sadj.rd..':'..nj..':'..tostring(prd))
		local prd,ni,s = p2side(p, side, side.fr) --, nj == 1 and true or false)
--                lo('?? for_prd:'..nj..':'..tostring(prd)..':'..tostring(ni)..':'..tostring(s))
--                        lo('?? for_node:'..sadj.rd..':'..nj..':'..tostring(prd))
		local prd,ni,s = p2side(p, side, side.fr) --, nj == 1 and true or false)
--                lo('?? for_prd:'..nj..':'..tostring(prd)..':'..tostring(ni)..':'..tostring(s))
--                        lo('?? for_node:'..sadj.rd..':'..nj..':'..tostring(prd))
--                lo('?? for_prd:'..nj..':'..tostring(prd)..':'..tostring(ni)..':'..tostring(s))
--                        lo('?? for_node:'..sadj.rd..':'..nj..':'..tostring(prd))
--                    out.awhite[#out.awhite + 1] = prd
--                        out.ayel[#out.ayel + 1] = p
--                        lo('?? red:'..tostring(nj)..'/'..tostring(igreen))
--            if igreen and not ired then
--                        out.ayel[#out.ayel + 1] = p
--                        lo('?? red:'..tostring(nj)..'/'..tostring(igreen))
--            if igreen and not ired then
--                        out.agreen[#out.agreen + 1] = p
--                        lo('?? green:'..tostring(nj))
			igreen = nj
	end
--        lo('?? fro_RG:'..tostring(ired)..':'..tostring(igreen)..':'..tostring(dgreen)..':'..tostring(dred))
	local p
	end
--        lo('?? fro_RG:'..tostring(ired)..':'..tostring(igreen)..':'..tostring(dgreen)..':'..tostring(dred))
	local p
	end
--        lo('?? fro_RG:'..tostring(ired)..':'..tostring(igreen)..':'..tostring(dgreen)..':'..tostring(dred))
	local p
	end
--        lo('?? fro_RG:'..tostring(ired)..':'..tostring(igreen)..':'..tostring(dgreen)..':'..tostring(dred))
	local p
			local s = dgreen/(dgreen + dred)
	--            lo('?? SET:'..i..':'..s..':'..tostring(ired)..':'..tostring(igreen)..':'..tostring(anobj[ired]))
			p = pgreen*(1-s) + pred*s
			local s = dgreen/(dgreen + dred)
	--            lo('?? SET:'..i..':'..s..':'..tostring(ired)..':'..tostring(igreen)..':'..tostring(anobj[ired]))
			p = pgreen*(1-s) + pred*s
			local s = dgreen/(dgreen + dred)
	--            lo('?? SET:'..i..':'..s..':'..tostring(ired)..':'..tostring(igreen)..':'..tostring(anobj[ired]))
			p = pgreen*(1-s) + pred*s
		margin + anobjus[side.fr].width/2 + mm_depth[2], parity)
						lo('?? for_p:'..tostring(p)..':'..dplus)
--                        out.acyan = {p}
		local last = side.dir < 0 and n2d[side.fr].d or 0
--            U.dump(side,'?? forLimit:'..ni..':'..tostring(node_dist[ni - side.dir])..':'..tostring(node_dist[ni]))
		if ni - side.dir < #node_dist then
		local last = side.dir < 0 and n2d[side.fr].d or 0
--            U.dump(side,'?? forLimit:'..ni..':'..tostring(node_dist[ni - side.dir])..':'..tostring(node_dist[ni]))
		if ni - side.dir < #node_dist then
--                        out.awhite = {corner}
--                            lo('?? for_ni:'..ni..':'..s..':'..tostring(d))
				local cc,v = sidePush(side)
					lo('?? prev_BR:'..i..':'..tostring(cc)..':'..tostring(v))
				if cc then
				local cc,v = sidePush(side)
					lo('?? prev_BR:'..i..':'..tostring(cc)..':'..tostring(v))
				if cc then
				end
	--                lo('?? prev_BR2:'..i..':'..tostring(corner))
	--                out.awhite = {corner}
					local anobjprev = editor.getNodes(scenetree.findObjectById(adec[sideprev.rd].id))
	--                    lo('?? for_PREV:'..tostring(anobjprev[side.fr]))
	--                    if true then return end
						mm_depth[2] + margin + anobj[side.fr].width/2)
	--                        lo('?? for_p:'..tostring(p))
	--                        out.acyan = {p}
						end
							lo('?? SHIFTED_along:'..shift..':'..tostring(pbound))
					end
--                    out.agreen = {base[2+ishift]}
					lo('?? for_def:'..inprev..':'..#base..':'..ishift..':'..tostring(pproj))
				local dft = (margin + anobj[inprev].width/2) - (base[2+ishift] - pproj):length()
							sideWidth(sideprev, sideprev.to, 0, anthem), sideWidth(side, side.fr, mm_depth[2]))
--                            lo('?? ppu:'..tostring(ppushed))
		--                        out.acyan = {ppushed}
					end
		--                lo('?? forPM:'..k..':'..tostring(pm)..':'..tostring(dm)..'/'..ddef)
				end
					end
		--                lo('?? forPM:'..k..':'..tostring(pm)..':'..tostring(dm)..'/'..ddef)
				end
				end
					lo('?? DM_pu:'..tostring(dm))
				if dm and dm > ddef then
--            out.acyan = {ppushed}
				lo('?? ppu_next:'..tostring(ppushed))
		if ppushed then
			local prd,nip,sip = p2side(ppushed, side)
	--            lo('?? pp:'..tostring(ppushed)..':'..nip..':'..sip..':'..tostring(dma))
	--            out.agreen = {prd}
			local prd,nip,sip = p2side(ppushed, side)
	--            lo('?? pp:'..tostring(ppushed)..':'..nip..':'..sip..':'..tostring(dma))
	--            out.agreen = {prd}
--            local cdma = distOnSide(abase[1][#abase[1]], side)
				lo('?? ON_SIDE:'..tostring(cdma))
			if dma then
			if pa then
					U.dump(side, '?? for_dma:'..i..':'..tostring(pa))
--                    out.ayel = {pa}

--                U.dump(aside[(i - 2) % #aside + 1], '?? for_CC:'..tostring(corner)..':'..tostring(dma))
				--!!

--                U.dump(aside[(i - 2) % #aside + 1], '?? for_CC:'..tostring(corner)..':'..tostring(dma))
				--!!
				if not icurv then icurv = side.to end
--                        lo('?? i_curv:'..tostring(icurv)..':'..(inprev+2*side.dir))
				curv = (bbase[2] - bbase[1]):cross(anode[icurv] - anode[inprev+side.dir]).z
				-- CONVEX CORNER
--                    lo('?? for_CONV:'..n..':'..#abase..':'..tostring(icurv)..'/'..inprev)
--                local nilast,slast
					for j = inprev,icurv,side.dir do
--                            lo('?? for_j:'..j..':'..tostring(pbound))
--                        p2side(pbound, side, j, true)
						local cprd,cni,s = p2side(pbound, side, j)
--                                lo('?? for_sss:'..j..':'..tostring(s))
						if cprd and s > 0 and s < 1 then
						end
--                        lo('?? for_s:'..j..':'..tostring(ni)..':'..tostring(s))
					end
						end
--                        lo('?? for_s:'..j..':'..tostring(ni)..':'..tostring(s))
					end
				if prd and anobj and anobj[ni] then
--                        lo('?? for_pp:'..tostring(prd)..':'..tostring(anobj[ni])..':'..tostring(pbound))
					corner = prd + (margin + anobj[ni].width/2)*(pbound - prd):normalized()
				if prd and anobj and anobj[ni] then
--                        lo('?? for_pp:'..tostring(prd)..':'..tostring(anobj[ni])..':'..tostring(pbound))
					corner = prd + (margin + anobj[ni].width/2)*(pbound - prd):normalized()
				if prd and anobj and anobj[ni] then
--                        lo('?? for_pp:'..tostring(prd)..':'..tostring(anobj[ni])..':'..tostring(pbound))
					corner = prd + (margin + anobj[ni].width/2)*(pbound - prd):normalized()
				else
					lo('!! ERR_no_anobj:'..tostring(ni))
				end
--                    out.awhite = {ppp}
--                    U.dump(n2d, '?? DMA:'..tostring(dma)..':'..tostring(ni)..':'..tostring(s)..':'..(n2d[side.fr].d - n2d[ni].d))
--                    dma = 130
--                    out.awhite = {ppp}
--                    U.dump(n2d, '?? DMA:'..tostring(dma)..':'..tostring(ni)..':'..tostring(s)..':'..(n2d[side.fr].d - n2d[ni].d))
--                    dma = 130
--                    out.awhite = {ppp}
--                    U.dump(n2d, '?? DMA:'..tostring(dma)..':'..tostring(ni)..':'..tostring(s)..':'..(n2d[side.fr].d - n2d[ni].d))
--                    dma = 130
				end
--                lo('?? DMA:'..tostring(dma)..':'..tostring(vnode))
--                if i == 4 then return end
				end
--                lo('?? DMA:'..tostring(dma)..':'..tostring(vnode))
--                if i == 4 then return end
			dma = d
					U.dump(aside[i+1], '?? for_PRD:'..tostring(prd)..' dma:'..tostring(dma))
]]
			dma = d
					U.dump(aside[i+1], '?? for_PRD:'..tostring(prd)..' dma:'..tostring(dma))
]]
				margin + anobj[side.to].width/2 + mm_depth[2], -1)
				U.dump(side, '??__________ pushed_for_1st:'..tostring(p))
			local prd = p2side(p, side)
					local p,d = forLimit(side, aside[j], 1, mm_depth[2])
						lo('??___________ PD:'..tostring(p)..':'..tostring(d)..'/'..dma)
					if d and d > dma then
					local p,d = forLimit(side, aside[j], 1, mm_depth[2])
						lo('??___________ PD:'..tostring(p)..':'..tostring(d)..'/'..dma)
					if d and d > dma then
					local prd,ni,s = p2side(p, side, side.fr)
--                        lo('?? for_node:'..sadj.rd..':'..nj..':'..tostring(prd))
	--                    out.awhite[#out.awhite + 1] = prd
--                            out.ayel[#out.ayel + 1] = p
--                            lo('?? red:'..tostring(nj)..'/'..tostring(igreen))
						if igreen and not ired then
--                            out.ayel[#out.ayel + 1] = p
--                            lo('?? red:'..tostring(nj)..'/'..tostring(igreen))
						if igreen and not ired then
					else
--                        lo('?? green:'..tostring(nj))
--                        out.agreen[#out.agreen + 1] = p
					local s = dgreen/(dgreen + dred)
						lo('?? SET:'..i..':'..s..':'..tostring(ired)..':'..tostring(igreen)..':'..tostring(anobj[ired]))
					local p = pgreen*(1-s) + pred*s
					local s = dgreen/(dgreen + dred)
						lo('?? SET:'..i..':'..s..':'..tostring(ired)..':'..tostring(igreen)..':'..tostring(anobj[ired]))
					local p = pgreen*(1-s) + pred*s
					local s = dgreen/(dgreen + dred)
						lo('?? SET:'..i..':'..s..':'..tostring(ired)..':'..tostring(igreen)..':'..tostring(anobj[ired]))
					local p = pgreen*(1-s) + pred*s
				end
					lo('?? iRG:'..tostring(ired)..':'..tostring(igreen)..':'..tostring(dred)..':'..tostring(dgreen))
			end
				end
					lo('?? iRG:'..tostring(ired)..':'..tostring(igreen)..':'..tostring(dred)..':'..tostring(dgreen))
			end
				end
					lo('?? iRG:'..tostring(ired)..':'..tostring(igreen)..':'..tostring(dred)..':'..tostring(dgreen))
			end
				end
					lo('?? iRG:'..tostring(ired)..':'..tostring(igreen)..':'..tostring(dred)..':'..tostring(dgreen))
			end
				local curvside = forStem(aside[i-1],1):cross(forStem(side, 0)).z
						lo('?? scurv:'..angside..':'..curvside..':'..tostring(space))
				if curvside < 0 then
					local prd,ni = p2side(pbound, aside[i], side.fr)
						lo('?? prd:'..tostring(prd)..':'..tostring(ni)..':'..side.fr)
					if prd and ni ~= side.fr then
					local prd,ni = p2side(pbound, aside[i], side.fr)
						lo('?? prd:'..tostring(prd)..':'..tostring(ni)..':'..side.fr)
					if prd and ni ~= side.fr then
				corner = prd + (margin + anobj[ni].width/2)*(p - prd):normalized()
					lo('?? for_p:'..tostring(p))
--                    out.ayel = {prd}
			local d = U.proj2D(p):distanceToLineSegment(U.proj2D(r.list[i]), U.proj2D(r.list[i+1]))
--                if ind == 1 and i == 1 then lo('?? dd:'..tostring(d)) end
			if d < dmi then
--    local L = W.out.L
--        U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)) --..':'..tostring(across[rmi])) --tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--    local L = W.out.L
--        U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)) --..':'..tostring(across[rmi])) --tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--    local L = W.out.L
--        U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)) --..':'..tostring(across[rmi])) --tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--    local L = W.out.L
--        U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)) --..':'..tostring(across[rmi])) --tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--    local L = W.out.L
--        U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)) --..':'..tostring(across[rmi])) --tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--    local L = W.out.L
--        U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)) --..':'..tostring(across[rmi])) --tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--        local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
--        lo('?? ij:'..i..':'..j..':'..tostring(across[i]))
	if rmi and across[rmi] and adec[rmi] then
local function populate(acrs, adecal, odec, oworld, cancel, pt)
		lo('>>++++++++++++++++++++++++++ populate:'..tostring(cpoint)..':'..tostring(out.inpave))
	if out.inpave or cancel == true then
local function populate(acrs, adecal, odec, oworld, cancel, pt)
		lo('>>++++++++++++++++++++++++++ populate:'..tostring(cpoint)..':'..tostring(out.inpave))
	if out.inpave or cancel == true then
	local p = cpoint -- cameraMouseRayCast().pos
--        U.dump(adec[133], '?? pop_adec:'..tableSize(adec)..':'..tostring(p))
--    out.avedit = {}
			local d = U.proj2D(p):distanceToLineSegment(U.proj2D(r.list[i]), U.proj2D(r.list[i+1]))
--                if ind == 1 and i == 1 then lo('?? dd:'..tostring(d)) end
			if d < dmi then
--    local L = W.out.L
		U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)..':'..tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--    local L = W.out.L
		U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)..':'..tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--    local L = W.out.L
		U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)..':'..tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--    local L = W.out.L
		U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)..':'..tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--    local L = W.out.L
		U.dump(across[rmi], '??____________ mi: nmi='..nmi..' dmi:'..dmi..' rmi:'..tostring(rmi)..':'..tostring(adec[rmi].list[nmi])..':'..tableSize(across)) --..':'..tostring(adec[rmi].list[nmi])..':'..tostring(adec[rmi].list[nmi+1])..':'..tostring(p))
--        local grid = 10
--        local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
--        lo('?? ij:'..i..':'..j..':'..tostring(across[i]))
	if across[rmi] then
	else
			U.dump(adec[rmi], '!! NO_CROSS:'..tostring(rmi)..':'..tostring(n))
--            U.dump(nil, '?? ij:'..i..':'..j..':'..tostring(across[i]))
	else
			U.dump(adec[rmi], '!! NO_CROSS:'..tostring(rmi)..':'..tostring(n))
--            U.dump(nil, '?? ij:'..i..':'..j..':'..tostring(across[i]))
			U.dump(adec[rmi], '!! NO_CROSS:'..tostring(rmi)..':'..tostring(n))
--            U.dump(nil, '?? ij:'..i..':'..j..':'..tostring(across[i]))
	end
		if rayCast.object.name ~= 'theTerrain' then return end
			lo('??_ region_CLICK:'..rayCast.object.name..':'..tostring(cpoint))
		if editor.keyModifiers.ctrl then return end
	elseif rayCast and im.IsMouseReleased(0) then
--            lo('?? R.upd:'..tostring(rayCast.object.name))
		if editor.keyModifiers.shift and rayCast.object.name == 'theTerrain' then
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_Enter)) and out.inpave then
--        lo('??+++++++++++++++++++++++++++++++++++++++++++++++ region_to_GEN:'..#abase..':'..tostring(out.inpave))
		if #abase > 0 then

	--            U.dump(aref, '?? updated:'..tostring(aref))
	--            U.dump(adec, '?? adec:'..#adec)
	end
		lo('>>++++++++__________ conform:'..L..':'..tableSize(adec)..':'..tableSize(aref)..':'..#aref..':'..tostring(U._mode))
--        U.dump(aref, '?? AREF:')
--    local ndecal = editor.getDecalTemplates():size()
--        lo('?? ndec:'..tostring(out.inconform)) --tostring(Engine.Render.DecalMgr.getSet())) --..tostring(Engine.Render.DecalMgr.getClosestDecal(vec3(0,0,0)))) --..tostring(editor.getDecalInstance(1)))
--    local ndecal = editor.getDecalTemplates():size()
--        lo('?? ndec:'..tostring(out.inconform)) --tostring(Engine.Render.DecalMgr.getSet())) --..tostring(Engine.Render.DecalMgr.getClosestDecal(vec3(0,0,0)))) --..tostring(editor.getDecalInstance(1)))
--    local ndecal = editor.getDecalTemplates():size()
--        lo('?? ndec:'..tostring(out.inconform)) --tostring(Engine.Render.DecalMgr.getSet())) --..tostring(Engine.Render.DecalMgr.getClosestDecal(vec3(0,0,0)))) --..tostring(editor.getDecalInstance(1)))
--    local ndecal = editor.getDecalTemplates():size()
--        lo('?? ndec:'..tostring(out.inconform)) --tostring(Engine.Render.DecalMgr.getSet())) --..tostring(Engine.Render.DecalMgr.getClosestDecal(vec3(0,0,0)))) --..tostring(editor.getDecalInstance(1)))
			out.avedit = {}
			U.dump(desc.afloor[1].base, '>> conform: pos = '..tostring(desc.pos)..' c:'..tostring(c)..' hbase:'..hbase..':'..tostring(indrag)) --..':'..desc.id)
			out.apoint = {c + vec3(0, 0, hbase + W.forHeight(desc.afloor) + 0.0)}
			out.avedit = {}
			U.dump(desc.afloor[1].base, '>> conform: pos = '..tostring(desc.pos)..' c:'..tostring(c)..' hbase:'..hbase..':'..tostring(indrag)) --..':'..desc.id)
			out.apoint = {c + vec3(0, 0, hbase + W.forHeight(desc.afloor) + 0.0)}
			out.avedit = {}
			U.dump(desc.afloor[1].base, '>> conform: pos = '..tostring(desc.pos)..' c:'..tostring(c)..' hbase:'..hbase..':'..tostring(indrag)) --..':'..desc.id)
			out.apoint = {c + vec3(0, 0, hbase + W.forHeight(desc.afloor) + 0.0)}
			out.apick = {}
--        lo('?? R:'..r..' h:'..hbase..' c:'..tostring(c))
	local xmima, ymima = {math.huge, 0},{math.huge, 0}
	local xmima, ymima = {math.huge, 0},{math.huge, 0}
			lo('?? X_lim:'..tostring(math.floor(c.x - r))..':'..tostring(math.ceil(c.x + r)), true)
			lo('?? Y_lim:'..math.floor(c.y - r)..':'..math.ceil(c.y + r), true)
	local xmima, ymima = {math.huge, 0},{math.huge, 0}
			lo('?? X_lim:'..tostring(math.floor(c.x - r))..':'..tostring(math.ceil(c.x + r)), true)
			lo('?? Y_lim:'..math.floor(c.y - r)..':'..math.ceil(c.y + r), true)
--                    if i == 1 and d <= mantle then
--                        lo('?? for_p:'..tostring(p - pos)..':'..d)
--                    end
--                    end
--                    lo('?? for_d:'..i..':'..d..':'..tostring(p)..':'..tostring(a)..':'..tostring(b))
				if d < dmi then
--                    end
--                    lo('?? for_d:'..i..':'..d..':'..tostring(p)..':'..tostring(a)..':'..tostring(b))
				if d < dmi then
--                    end
--                    lo('?? for_d:'..i..':'..d..':'..tostring(p)..':'..tostring(a)..':'..tostring(b))
				if d < dmi then
--                    out.avedit[#out.avedit + 1] = vec3(x, y, hbase) -- desc.pos.z + 5)
--                lo('?? step:'..dmi) -- ..tostring(M.step(base, dmi)))
				hmapChange(p, hbase)
--                                        if ij[1] == 101 and ij[2] == 101 then
--                                            U.dump(aref[ij[1]][ij[2]], '?? CHECK:'..tostring(hasnodes))
--                                        end
	out.inconform = true
		lo('??*************************** conf3:'..tostring(inmantle)..':'..desc.id)
--        lo('?? conformed:'..#shmap)
		desc.pos.z = hbase
			lo('?? obi:'..tostring(scenetree.findObjectById(desc.id)))
--        for _,s in pairs(dforest) do
		if #asel > 0 and desc.id == asel[#asel] then
			U.dump(adec, '?? LAST:'..tostring(N.cid)) --adec[17].id)
			D.ter2road(nil, N.cid)
@/lua/ge/extensions/c2/panelPlugins/tileManager.lua

            im.TableNextColumn() im.Text(tostring(ctx))
            im.TableNextColumn() im.Text(tostring(cty))
            im.TableNextColumn() im.Text(tostring(ctx))
            im.TableNextColumn() im.Text(tostring(cty))
            im.TableNextColumn() im.Text(tostring(#data.objects))
            im.TableNextColumn() im.Text(tostring(cty))
            im.TableNextColumn() im.Text(tostring(#data.objects))
            im.TableNextColumn() im.Text(tostring(#data.forestItems))
            im.TableNextColumn() im.Text(tostring(#data.objects))
            im.TableNextColumn() im.Text(tostring(#data.forestItems))
            im.TableNextColumn() im.Text(tostring(#data.decals))
            im.TableNextColumn() im.Text(tostring(#data.forestItems))
            im.TableNextColumn() im.Text(tostring(#data.decals))
            im.TableNextColumn() im.Text(tostring(#data.roadMarkings))
            im.TableNextColumn() im.Text(tostring(#data.decals))
            im.TableNextColumn() im.Text(tostring(#data.roadMarkings))
            im.TableNextColumn() im.Text(tostring(#data.aiNodes))
            im.TableNextColumn() im.Text(tostring(#data.roadMarkings))
            im.TableNextColumn() im.Text(tostring(#data.aiNodes))
            im.TableNextColumn() im.Text(string.format("%.1f", data.metadata.sizeKB or 0))
      else
        log("E", "tileManager", "Failed to encode tile data: " .. tostring(encoded))
        server:sendData(evt.peerId, jsonEncode({ type = "error", msg = "Encoding error" }))
@/lua/ge/extensions/editor/autoSave.lua
    for k = tableSize(autosaves), 1, -1 do
      imgui.PushID1(tostring(k))
      if imgui.Selectable1(autosaves[k].displayPath .. " @ " ..  autosaves[k].datetime, k == selectedAutosaveIndex) then
@/lua/ge/extensions/editor/sceneView.lua
  if data == nil then data = {} end
  local newName = sceneViewName or 'Scene view ' .. tostring(tableSize(sceneViews) + 1)
  sceneViews[newName] = {
      im.PushStyleVar2(im.StyleVar_WindowPadding, im.ImVec2(6, 6))
      if im.BeginPopup('viewcontrol' .. tostring(sceneViewName)) then
        local changedOrtho = false
      if im.IsItemClicked(1) then
        im.OpenPopup('viewcontrol' .. tostring(sceneViewName))
      end
@/lua/ge/extensions/ui/vehiclePaint.lua
  tempFloat[0] = data[index]
  if(ui_imgui.SliderFloat(id..'##'..tostring(array), tempFloat, 0, 1)) then
    data[index] = tempFloat[0]
@/lua/ge/extensions/tech/sumoExporter.lua
    file:write(string.format('\t\n',
      tostring(node.id), node.x, node.y, node.z))
  end
  for _, edge in ipairs(edges) do
    local id1 = "e" .. tostring(ctr)
    file:write(string.format('\t\n',
    -- Add reverse edge (bi-directional)
    local id2 = "e" .. tostring(ctr)
    file:write(string.format('\t\n',
@/lua/ge/extensions/editor/forestEditor.lua
  print("##### Brush Properties #####")
  print("Size: " .. tostring(var.forestBrushTool:getSize()))
  print("Pressure: " .. tostring(var.forestBrushTool:getPressure()))
  print("Size: " .. tostring(var.forestBrushTool:getSize()))
  print("Pressure: " .. tostring(var.forestBrushTool:getPressure()))
  print("Hardness: " .. tostring(var.forestBrushTool:getHardness()))
  print("Pressure: " .. tostring(var.forestBrushTool:getPressure()))
  print("Hardness: " .. tostring(var.forestBrushTool:getHardness()))
  print("##### Brush Properties End #####")
  if not tableIsEmpty(editor.selection.forestItem) then
    local shapeFilename = tostring(editor.selection.forestItem[#editor.selection.forestItem]:getData().shapeFile)
    var.meshPreview:setObjectModel(shapeFilename)
      if forestItemData then
        shapeFilename = tostring(forestItemData.shapeFile)
      end
    if obj then
      shapeFilename = tostring(obj.shapeFile)
      var.meshPreview:setObjectModel(shapeFilename)
    incr = incr + 1
    name = "Brush" .. tostring(incr)
  end
    incr = incr + 1
    name = "Element" .. tostring(incr)
  end
    im.Columns(2, "assetInspectorGuiForestItem_columns")
    inspectorField_String("Key", tostring(item:getKey()))
    -- im.Columns(1)
      im.NextColumn()
      im.TextUnformatted(tostring(item:getUid()))
      im.SameLine()
      if im.Button("Copy") then
        setClipboard(tostring(item:getUid()))
      end
    im.NextColumn()
    -- im.TextUnformatted("Pos : "..tostring (item:getPosition()))
    im.TextUnformatted("Scale")
    im.NextColumn()
    --inspectorField_String("Scale", tostring(item:getScale()))

    -- im.TextUnformatted("Tr : "..tostring (item:getTransform()))
    -- el = item:getTransform():toEuler()
    -- el = item:getTransform():toEuler()
    -- im.TextUnformatted("Tr el: "..tostring (el))
    inspectorField_String("Shape", tostring(item:getData():getShapeFile()))
    -- im.TextUnformatted("Tr el: "..tostring (el))
    inspectorField_String("Shape", tostring(item:getData():getShapeFile()))
    else
      editor.logWarn("Missing forest brush element ID: " .. tostring(id))
    end
    end
    if im.InputText("##" .. item.internalName .. "_inputText_FB_" .. tostring(item.id), var.editingNameCharPtr, nil, im.InputTextFlags_EnterReturnsTrue) then
      local internalName = ffi.string(var.editingNameCharPtr)
    im.PushStyleColor2(im.Col_Button, (item.selected == true) and var.buttonColor_active or var.buttonColor_inactive)
    local id = item.type == var.enum_forestObjType.forestBrush and ("##" .. item.internalName .. "_button_FB_" .. tostring(item.id)) or ("##" .. item.internalName .. "_button_FBE_" .. tostring(item.id))
    if im.Button(id, im.ImVec2(im.GetContentRegionAvailWidth(), var.fontSize)) then
    im.PushStyleColor2(im.Col_Button, (item.selected == true) and var.buttonColor_active or var.buttonColor_inactive)
    local id = item.type == var.enum_forestObjType.forestBrush and ("##" .. item.internalName .. "_button_FB_" .. tostring(item.id)) or ("##" .. item.internalName .. "_button_FBE_" .. tostring(item.id))
    if im.Button(id, im.ImVec2(im.GetContentRegionAvailWidth(), var.fontSize)) then
  --TODO: make sure to make a better nil check for internalName
  if im.Button("##" .. (obj.internalName or "unnamed") .. "_button_FID_" .. tostring(item.id), im.ImVec2(im.GetContentRegionAvailWidth(), var.fontSize)) then
    -- add to selection if ctrl is held
local function textureSetImageButton(imgSize, id, tooltip)
  local selectedTextureSetIdStr = tostring(pM_selectedTextureSetId)
  local imgPath = ""
  for i = 1, 128 do
    if pM_textureSets.data[tostring(i)] then
      local cPos = im.GetCursorPos()

  local pM_selectedTextureSetData = pM_textureSets.data[tostring(pM_selectedTextureSetId)]
  --
  if im.Button("Copy##TextureSet") then
    pM_textureSetCopy = deepcopy(pM_textureSets.data[tostring(pM_selectedTextureSetId)])
  end
  if im.Button("Paste##TextureSet") then
    pM_textureSets.data[tostring(pM_selectedTextureSetId)] = deepcopy(pM_textureSetCopy)
    pM_textureSetDirty = true
  if im.Button("Clear##TextureSet") then
    pM_textureSets.data[tostring(pM_selectedTextureSetId)] = nil
    pM_textureSetDirty = true
  if im.Button("Save##SaveCurrentTextureSetButton") then
    pM_textureSets.data[tostring(pM_selectedTextureSetId)] = pM_selectedTextureSetData
    jsonWriteFile(pM_textureSetsFilePath, pM_textureSets, true)
    if object and object:getClassName() == "ForestItemData" and fieldNameLower == "shapefile" then
      local shapeFilename = tostring(object.shapeFile)
      var.meshPreview:setObjectModel(shapeFilename)
      if forestItemData then
        local shapeFilename = tostring(forestItemData.shapeFile)
        var.meshPreview:setObjectModel(shapeFilename)
@/lua/ge/extensions/core/snapshot.lua
    if id then
      log('I', "snapshot", "Snapshot saved, ID: " .. tostring(id))
    end
local function loadSnapshot(snapshotId)
  log('I', "snapshot", "Downloading snapshot " .. tostring(snapshotId) .."...")
  core_online.apiCall('s2/v4/getSnapshot', function(request)
@/lua/ge/extensions/remoteControl/remoteControl.lua
    {'/hello/(%d+)', function(req, res)
      return 'hello world: ' .. tostring(res[1])
    end},
  if vim and deviceInst then
    vim:unregisterDevice('vinput' .. tostring(deviceInst))
  end
@/lua/ge/extensions/util/nodeStream.lua
          type = "error",
          msg  = "Failed to load extension: " .. tostring(err)
        }))
local function onExtensionLoaded()
  log("I", "nodeStream", "Extension loading, creating WebSocket on port " .. tostring(port))
  server, chosenAddress = wsUtils.createOrGetWS("127.0.0.1", port, "", 'nodestream', "", false)
  if server then
    log("I", "nodeStream", "Node stream WebSocket server started at: http://" .. chosenAddress .. ":" .. tostring(port))
  else
        else
          log("E", "nodeStream", "Failed to decode JSON: " .. tostring(evt.msg))
        end
      -- Client connected
      log("I", "nodeStream", "Client connected with ID: " .. tostring(evt.peerId))
    elseif evt.type == "DC" then
      -- Client disconnected
      log("I", "nodeStream", "Client disconnected with ID: " .. tostring(evt.peerId))
    end
@/lua/ge/client/core.lua
  for _, filename in ipairs(subfiles) do
    -- log('I','core', '      '..tostring(filename))
    loadJsonMaterialsFile(filename)
@/lua/ge/extensions/editor/driftDataEditor.lua
    for _, n in ipairs(stuntZonePreset.presets) do
      s = s .. tostring(n) .. "\0"
    end
  if not json then
    log('E', logTag, 'unable to find driftData file: ' .. tostring(filename))
    return
@/lua/ge/extensions/editor/gen/exp_solidflex.lua
    scenetree.findObject('m_greybox_base_bat').doubleSided = true
--        lo('?? M1:'..tostring(nm))
    local id,om = M.meshUp({m},'tst', scenetree.findObject('edit'))
        lo('?? init:'..tostring(id)..':'..tostring(om)..':'..tostring(scenetree.findObject('edit')))
    body = om
    local id,om = M.meshUp({m},'tst', scenetree.findObject('edit'))
        lo('?? init:'..tostring(id)..':'..tostring(om)..':'..tostring(scenetree.findObject('edit')))
    body = om
    local id,om = M.meshUp({m},'tst', scenetree.findObject('edit'))
        lo('?? init:'..tostring(id)..':'..tostring(om)..':'..tostring(scenetree.findObject('edit')))
    body = om
    end
--        print('?? if_MESH_cs:'..tostring(id))
end

--        lo('?? build:'..#an..':'..tostring(an[0]))
    local av = {vec3(0,0,1.5),vec3(0,1,1.5)}
--        local vb = av[#av-1-(1-aind[i])/2]
--            U.dump(avp, '?? for_VB_W:'..i..' vb:'..tostring(vb)..' w:'..tostring(w))
        local u = -aind[i]*(vb - av[#av]):cross(w):normalized()
--        local vb = av[#av-1-(1-aind[i])/2]
--            U.dump(avp, '?? for_VB_W:'..i..' vb:'..tostring(vb)..' w:'..tostring(w))
        local u = -aind[i]*(vb - av[#av]):cross(w):normalized()
--            U.dump(aax[#aax-1], '?? aax-1:')
--            U.dump(avp, '?? for_U_AVP:'..i..' u:'..tostring(u))
--        av[#av+1] = (av[#av] + vb)/2 + (u*math.cos(ac[i]) + w*math.sin(ac[i]))*ah[i]
        an[#an+1] = -aind[i]*(av[#av] - vb):cross(av[#av] - av[#av-1]):normalized()
--            lo('?? for_AN:'..i..':'..tostring(an[#an])..' aind:'..aind[i])
--        auv[#auv+1] = {u=0, v=0}
        af[#af+1] = {v=#av-1, u=#auv-1, n=#an-1}
--            lo('?? if_AV:'..i..' w:'..tostring(w)..' u:'..tostring(u)..':'..tostring(an[#an]))
--            U.dump(av, '?? av:')
        af[#af+1] = {v=#av-1, u=#auv-1, n=#an-1}
--            lo('?? if_AV:'..i..' w:'..tostring(w)..' u:'..tostring(u)..':'..tostring(an[#an]))
--            U.dump(av, '?? av:')
        af[#af+1] = {v=#av-1, u=#auv-1, n=#an-1}
--            lo('?? if_AV:'..i..' w:'..tostring(w)..' u:'..tostring(u)..':'..tostring(an[#an]))
--            U.dump(av, '?? av:')
    an[0] = nil
--        U.dump(aax, '?? build:'..tostring(av[aax[#aax][1][2]])..':'..tostring(av[#av]))
    segpick = {
    an[0] = nil
--        U.dump(aax, '?? build:'..tostring(av[aax[#aax][1][2]])..':'..tostring(av[#av]))
    segpick = {
local function rebuild(ac)
--        lo('>> rebuild:'..tostring(cvneigh))
    m = build(ac or aa)
    if not mute then
        lo('>> onVal_e_SF:'..tostring(k)..':'..tostring(val))
    end
    if not mute then
        lo('>> onVal_e_SF:'..tostring(k)..':'..tostring(val))
    end
    elseif k == 'reset' then
            lo('?? reset:'..tostring(body))
        if body then body:delete() end
        local id,om = M.meshUp({m},'tst', scenetree.findObject('edit'))
            lo('?? if_MESH:'..tostring(id))
        body = om
W.gui = function()
--        lo('?? exp_sf.ui:'..tostring(wnm)..':'..tostring(editor.isWindowRegistered(wnm)))
    env = W
W.gui = function()
--        lo('?? exp_sf.ui:'..tostring(wnm)..':'..tostring(editor.isWindowRegistered(wnm)))
    env = W
            local color,cbg
--                lo('?? exp_sf.ui2:'..tostring(wlabel))
            im.PushStyleColor2(im.Col_FrameBg, im.ImVec4(0.2, 0.2, 0.2, 0.4))
                local scur = im.GetCursorPos()
--                    lo('?? scur:'..tostring(scur))
--                im.SetCursorPosY(scur.y - 10)
            focus = (vmil*amir+vmir*amil)/(amil+amir)
                lo('?? FOCUS:'..tostring(focus))
            -- dist to focus
                            W.out.overnode = cvneigh and 2 or 1
                                lo('?? close:'..i..':'..tostring(cvneigh)..':'..tostring(W.out.overnode))
                        end
                            W.out.overnode = cvneigh and 2 or 1
                                lo('?? close:'..i..':'..tostring(cvneigh)..':'..tostring(W.out.overnode))
                        end
    end
--    lo('?? '..tostring(tocur))
--    core_camera.getForward()
                local pto = U.onPlane(rayCast.pos, m.verts[cvover], m.verts[cvover] - vpin)
--                    lo('?? PTO:'..tostring(pto)..':'..tostring(m.verts[cvover] - vpin)..':'..tostring(rayCast.pos))
--                local pto = U.onPlane(rayCast, cpick, m.verts[cvover] - vpin)
                local pto = U.onPlane(rayCast.pos, m.verts[cvover], m.verts[cvover] - vpin)
--                    lo('?? PTO:'..tostring(pto)..':'..tostring(m.verts[cvover] - vpin)..':'..tostring(rayCast.pos))
--                local pto = U.onPlane(rayCast, cpick, m.verts[cvover] - vpin)
                local pto = U.onPlane(rayCast.pos, m.verts[cvover], m.verts[cvover] - vpin)
--                    lo('?? PTO:'..tostring(pto)..':'..tostring(m.verts[cvover] - vpin)..':'..tostring(rayCast.pos))
--                local pto = U.onPlane(rayCast, cpick, m.verts[cvover] - vpin)
--                local pto = U.onPlane(rayCast, cpick, m.verts[cvover]-m.verts[cvneigh])
--                    lo('?? toMOVE:'..cvover..':'..tostring(cpick)..':'..tostring(pto))
                cpick = pto
--                local pto = U.onPlane(rayCast, cpick, m.verts[cvover]-m.verts[cvneigh])
--                    lo('?? toMOVE:'..cvover..':'..tostring(cpick)..':'..tostring(pto))
                cpick = pto
--                    tgt = {vpin,m.verts[cvover]}
--                    lo('??^^^^^^^ TO:'..':'..cvover..' vpin:'..tostring(vpin)..' cpt:'..tostring(cpt)..':'..tostring(cpt-vpin))
                U.out.aset[3] = {set={tgt[2]}, c={1,0,1,0.2}}
--                    tgt = {vpin,m.verts[cvover]}
--                    lo('??^^^^^^^ TO:'..':'..cvover..' vpin:'..tostring(vpin)..' cpt:'..tostring(cpt)..':'..tostring(cpt-vpin))
                U.out.aset[3] = {set={tgt[2]}, c={1,0,1,0.2}}
--                    tgt = {vpin,m.verts[cvover]}
--                    lo('??^^^^^^^ TO:'..':'..cvover..' vpin:'..tostring(vpin)..' cpt:'..tostring(cpt)..':'..tostring(cpt-vpin))
                U.out.aset[3] = {set={tgt[2]}, c={1,0,1,0.2}}
    if im.IsMouseReleased(0) and inview then
--            lo('?? rel_CP:'..tostring(cpick)..':'..tostring(cvneigh))
    if im.IsMouseReleased(0) and inview then
--            lo('?? rel_CP:'..tostring(cpick)..':'..tostring(cvneigh))
--[[
            lo('?? post_REBUILD:'..tostring(cvneigh))
            if cvneigh then
            if cvneigh then
                U.dump(U.out.aset[1].set, '?? set_yel:'..tostring(m.verts[cvneigh]))
            end
        if focus and cclick then
--            lo('?? turn:'..tostring(W.isactive))
            local rnew = U.vturn(U.proj2D(r), 0.02*cclick) + vec3(0,0,r.z)
--                lo('?? turning:'..r:length()..':'..tostring(ccampos)..':'..tostring(focus))
            ccampos = focus + rnew
            local rnew = U.vturn(U.proj2D(r), 0.02*cclick) + vec3(0,0,r.z)
--                lo('?? turning:'..r:length()..':'..tostring(ccampos)..':'..tostring(focus))
            ccampos = focus + rnew
                local cdir = core_camera.getForward()
                    lo('?? cam_DIR:'..tostring(cdir))
                local r = campos - focus
@/lua/ge/extensions/flowgraph/nodes/vehicle/spawnVehicle.lua
  builder:Middle()
  im.Text("State:" .. tostring(self.state))
  im.Text("Veh Id:" .. tostring(self.spawnedObjectId))
  im.Text("State:" .. tostring(self.state))
  im.Text("Veh Id:" .. tostring(self.spawnedObjectId))
end
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/raceEditorPath.lua
  builder:Middle()
  im.Text("Source: " .. tostring(raceFileSource))
end
  im.Text("Race file:")
  im.Text(tostring(raceFileFname))
  im.Text("Source: " .. tostring(raceFileSource))
  im.Text(tostring(raceFileFname))
  im.Text("Source: " .. tostring(raceFileSource))
end
@/lua/ge/extensions/career/branches.lua
  end
  --log("I", "", branch.id .." is types: domain: " .. tostring(branch.isDomain) .. " branch: " .. tostring(branch.isBranch) .. " skill: " .. tostring(branch.isSkill))
  end
  --log("I", "", branch.id .." is types: domain: " .. tostring(branch.isDomain) .. " branch: " .. tostring(branch.isBranch) .. " skill: " .. tostring(branch.isSkill))
  end
  --log("I", "", branch.id .." is types: domain: " .. tostring(branch.isDomain) .. " branch: " .. tostring(branch.isBranch) .. " skill: " .. tostring(branch.isSkill))
@/lua/ge/extensions/editor/util/vehicleFilterUtil.lua
    else
      error('Failed to load configListGenerator in vehicleFilterUtil: ' .. tostring(result))
    end
@/lua/ge/extensions/editor/perfProfiler.lua
              end
              table.insert(lines,label..": "..tostring(val))
            end
          end
          im.Text(tostring(val))
          im.TableNextColumn()
@/lua/common/jbeam/utils.lua
    if node1 == nil then
      log('W', "jbeam.addBeamWithOptions","invalid node "..tostring(id1).." for new beam between "..tostring(id1).."->"..tostring(id2))
      return
    if node1 == nil then
      log('W', "jbeam.addBeamWithOptions","invalid node "..tostring(id1).." for new beam between "..tostring(id1).."->"..tostring(id2))
      return
    if node1 == nil then
      log('W', "jbeam.addBeamWithOptions","invalid node "..tostring(id1).." for new beam between "..tostring(id1).."->"..tostring(id2))
      return
    if node2 == nil then
      log('W', "jbeam.addBeamWithOptions","invalid node "..tostring(id2).." for new beam between "..tostring(id1).."->"..tostring(id2))
      return
    if node2 == nil then
      log('W', "jbeam.addBeamWithOptions","invalid node "..tostring(id2).." for new beam between "..tostring(id1).."->"..tostring(id2))
      return
    if node2 == nil then
      log('W', "jbeam.addBeamWithOptions","invalid node "..tostring(id2).." for new beam between "..tostring(id1).."->"..tostring(id2))
      return
    if node3 == nil then
      log('W', "jbeam.addBeamWithOptions","invalid node "..tostring(id3).." for new beam between "..tostring(id1).."->"..tostring(id2))
      return
    if node3 == nil then
      log('W', "jbeam.addBeamWithOptions","invalid node "..tostring(id3).." for new beam between "..tostring(id1).."->"..tostring(id2))
      return
    if node3 == nil then
      log('W', "jbeam.addBeamWithOptions","invalid node "..tostring(id3).." for new beam between "..tostring(id1).."->"..tostring(id2))
      return
@/lua/ge/extensions/util/testExtensionProxies.lua
function ExtensionProxyTester:onUpdate(dtReal, dtSim, dtRaw)
  print('ExtensionProxyTester:onUpdate called: ' .. tostring(self.id) .. ', ' .. tostring(dtReal))
end
function ExtensionProxyTester:onUpdate(dtReal, dtSim, dtRaw)
  print('ExtensionProxyTester:onUpdate called: ' .. tostring(self.id) .. ', ' .. tostring(dtReal))
end
@/lua/common/luaCore.lua
  if not m then
    log('W', "rerequire", ">>> Module failed to load: " .. tostring(module).." <<<")
  end
@/lua/ge/extensions/editor/dragRaceEditor/strips.lua
  editor_fileDialog.saveFile(function(data)
    log('D', 'drag_race_editor', 'File dialog callback triggered with path: ' .. tostring(data.filepath))
@/lua/ge/extensions/editor/dragRaceEditor/dragSettings.lua
  local levelName = getCurrentLevelIdentifier()
  log('D', 'drag_race_editor', 'Loading settings for level: ' .. tostring(levelName))
      local pathExists = FS:directoryExists(dragStripRacePath)
      log('D', 'drag_race_editor', 'dragStripRace path exists: ' .. tostring(pathExists))
      local pathExistsAPM = FS:directoryExists(dragStripAPMPath)
      log('D', 'drag_race_editor', 'dragStripAPM path exists: ' .. tostring(pathExistsAPM))
@/lua/ge/extensions/gameplay/drift/destination.lua
        im.Text(string.format("Dist. remaining before fail : %i m", maxWrongWayDist - currWrongWayDist))
        im.Text("Going the wrong way : " .. tostring(goingWrongWay))
        im.Text("Reversed race path : " .. tostring(reversedFlag))
        im.Text("Going the wrong way : " .. tostring(goingWrongWay))
        im.Text("Reversed race path : " .. tostring(reversedFlag))
        im.Text(string.format("Dist to intended road : %i m", distToIntendedRoad))
@/lua/ge/extensions/editor/assetManagementTool.lua

  editor.logInfo("Delinking " .. tostring(#filenames) .. " link files...")
  relinkFolderMaxCount = relinkFolderMaxCount + 1
  local relinkFolderPath = relinkFolderBaseName .. tostring(relinkFolderMaxCount)

  editor.logInfo("Relinking " .. tostring(totalFilenames) .. " link files...")
  imgui.Separator()
  imgui.Text(tostring(tableSize(assetsByHash)) .. " asset record(s)")
    imgui.SameLine()
    imgui.Text(", " .. tostring(selectedCount) .. " selected ")
  end
    imgui.SameLine()
    imgui.Text(", " .. tostring(visibleRecordCount) .. " found in filter")
  end
        if isFirstPath then
          imgui.TextColored(imgui.ImVec4(1, 1, 0, 1), tostring(mapping.recordIndex))
          imgui.SameLine()

          if imgui.Checkbox("##select" .. tostring(mapping.recordIndex), selectRecordBoolPtr) then
            if selectRecordBoolPtr[0] then
        imgui.TableNextColumn()
        imgui.PushID1(tostring(row))
        imgui.PushStyleColor2(imgui.Col_Button, imgui.ImVec4(0.3, 0, 0, 0.5))
        imgui.TableNextColumn()
        imgui.TextColored(imgui.ImVec4(1, 1, 0, 1), tostring(idx))
        imgui.TableNextColumn()
        imgui.TextColored(imgui.ImVec4(1, 1, 0, 1), tostring(idx))
        imgui.TableNextColumn()
        imgui.TextColored(imgui.ImVec4(1, 1, 0, 1), tostring(idx))
        imgui.TableNextColumn()
        imgui.TextColored(imgui.ImVec4(1, 1, 0, 1), tostring(idx))
@/lua/common/jbeamWriter.lua
  end
  if vtype == 'boolean' then return tostring(v) end
          local cv = jsonEncodePrettyJbeam(vv, lvl + 1, numberPrecision, maxLevelTmp)
          if cv ~= nil then table.insert(tmp, stringformat('"%s":%s', escapeString(tostring(kk)), cv)) end
        end
@/lua/ge/extensions/editor/main.lua
  if state.version ~= CurrentStateFileFormatVersion and not tableIsEmpty(state) then
    editor.logWarn("Editor state file format version mismatch. Expected: " .. CurrentStateFileFormatVersion .. " File: " .. tostring(state.version) .. ", will upgrade.")
    --TODO: upgrade code for older versions of the file
@/lua/ge/extensions/flowgraph/nodes/types/vec3.lua
  builder:Middle()
  im.Text(tostring(vec3(self.pinIn.x.value or 0, self.pinIn.y.value or 0, self.pinIn.z.value or 0)))
end
@/lua/ge/extensions/flowgraph/nodes/debug/log.lua
function C:createLogEntry()
  local msg = tostring(self.pinIn.value.value)
  if type(self.pinIn.value.value) == 'table' then
  builder:Middle()
  im.Text("('" .. tostring(self.pinIn.logType.value) .. "','" .. tostring(self.pinIn.logTag.value) .. "',...)")
end
  builder:Middle()
  im.Text("('" .. tostring(self.pinIn.logType.value) .. "','" .. tostring(self.pinIn.logTag.value) .. "',...)")
end
@/lua/ge/extensions/editor/dynamicDecals/layerTypes/brushStroke.lua
    for k, data in ipairs(layer.dataPoints) do
      im.TextUnformatted(tostring(k))
      im.SameLine()
@/lua/common/jbeam/sections/vropes.lua
    if prop.name == propName then
      --dump{ "Prop found: " .. tostring(propName) .. " with id: " .. tostring(prop.cid) .. dumps(prop) }
      return prop.cid
    if prop.name == propName then
      --dump{ "Prop found: " .. tostring(propName) .. " with id: " .. tostring(prop.cid) .. dumps(prop) }
      return prop.cid
  end
  log('E', 'jbeam.ropes', 'Prop not found: ' .. tostring(propName))
  return nil
              rope_count = rope_count + 1
              log('I', 'jbeam.ropes', 'Created rope ' .. ropeId .. ' (' .. tostring(ropeName) .. ') between nodes ' .. ropeConfig.anchorAProp .. ' and ' .. ropeConfig.anchorBProp)
            else
            else
              log('E', 'jbeam.ropes', 'Failed to get rope visual for ropeId: ' .. tostring(ropeId))
            end
          else
            log('E', 'jbeam.ropes', 'Failed to create rope visual for rope: ' .. tostring(ropeName))
          end
        else
          log('E', 'jbeam.ropes', 'Invalid anchor nodes for rope ' .. tostring(ropeName) .. ': anchorA=' .. tostring(ropeConfig.anchorAProp) .. ', anchorB=' .. tostring(ropeConfig.anchorBProp))
        end
        else
          log('E', 'jbeam.ropes', 'Invalid anchor nodes for rope ' .. tostring(ropeName) .. ': anchorA=' .. tostring(ropeConfig.anchorAProp) .. ', anchorB=' .. tostring(ropeConfig.anchorBProp))
        end
        else
          log('E', 'jbeam.ropes', 'Invalid anchor nodes for rope ' .. tostring(ropeName) .. ': anchorA=' .. tostring(ropeConfig.anchorAProp) .. ', anchorB=' .. tostring(ropeConfig.anchorBProp))
        end
      else
        log('E', 'jbeam.ropes', 'Rope configuration missing required anchorAProp or anchorBProp for rope: ' .. tostring(ropeName))
      end
@/lua/ge/extensions/gameplay/drag/general.lua
  else
    log('E', logTag, 'Unknown dragType: ' .. tostring(dragData.dragType))
    return false
  if not dragData then
    log('E', logTag, 'Failed to load drag strip data from file: ' .. tostring(filepath))
    return
@/lua/ge/extensions/core/paths.lua
  if not pathJsonObj then
    log('E', 'core_paths.loadPath', 'unable to find path file: ' .. tostring(pathFileName))
    return
  if not pathObj then
    log('E', 'core_paths.getPath', 'unable to find path: ' .. tostring(pathName))
    return
@/lua/objectpool/main.lua
print = function(...)
  log("A", "print", tostring(...))
end
  else
    log("E", "object", "invalid initData: " .. tostring(type(initData)) .. ": " .. tostring(initData))
  end
  else
    log("E", "object", "invalid initData: " .. tostring(type(initData)) .. ": " .. tostring(initData))
  end
@/lua/ge/extensions/editor/api/preferencesRegistry.lua
    item.type == "bool" then
      itemVal = tostring(itemVal)
  elseif item.type == "table" then
  then
    itemVal = tostring(itemVal)
    -- remove comma
              oldValue = val, -- keep the file value for onEditorPreferenceVersionChanged
              value = self:itemValueFromString(item, tostring(val)), -- try to convert (if type stayed the same)
              type = item.type,
@/lua/ge/extensions/tech/platoonFunctions.lua
      if id == vehicleID then
        local vehicle = tostring(vehicleID)
        be:sendToMailbox(tostring(vehicle), lpack.encodeBinWorkBuffer(i))
        local vehicle = tostring(vehicleID)
        be:sendToMailbox(tostring(vehicle), lpack.encodeBinWorkBuffer(i))
        return i  -- Return the index of the vehicle in the platoon
            if i > 1 then
              local vehicle = tostring(v)
              getRelayVehiclesID(leaderID, i)
    if i > 1 then
      local vehicle = tostring(v)
      local mailBoxName = "currentLeader"..vehicle
@/lua/ge/extensions/editor/rallyEditor/pacenotes.lua
  if not self.notes_valid then
    table.insert(self.validation_issues, tostring(invalid_notes_count)..' pacenote(s) have issues')
  end
  if self:isValid() then
    im.HeaderText(tostring(#notebook.pacenotes.sorted).." Pacenotes")
  else
  else
    im.HeaderText("[!] "..tostring(#notebook.pacenotes.sorted).." Pacenotes")
  end

  local newPacenote = self.path.pacenotes:create("Pacenote "..tostring(nextNum))
  self.path:sortPacenotesByName()
@/lua/ge/extensions/flowgraph/nodes/ui/imgui/imSimpleBox.lua
function C:work()
  im.Begin((self.pinIn.title.value or "Title") ..'##'.. tostring(self.id), im.BoolPtr(true))
  im.Text((self.pinIn.text.value or "Text"))
@/lua/ge/extensions/editor/rallyEditor/testTab.lua
  local pnName = self.path:getRandomSystemPacenote('firstnoteintro')
  print(tostring(pnName))
  pnName = self.path:getRandomSystemPacenote('firstnoteoutro')
  print(tostring(pnName))
  pnName = self.path:getRandomSystemPacenote('finish')
  print(tostring(pnName))
end
@/lua/ge/extensions/flowgraph/nodes/util/tostring.lua
function C:work()
  self.pinOut.value.value = tostring(self.pinIn.value.value)
end
@/lua/common/jbeam/sections/events.lua
      if abid ~= ab.cid then
        log('E', 'jbeam.events', 'Trigger cId desync: ' .. dumps(ab) .. ' / ' .. tostring(abid) ..  ' != ' .. tostring(ab.cid))
        goto continue
      if abid ~= ab.cid then
        log('E', 'jbeam.events', 'Trigger cId desync: ' .. dumps(ab) .. ' / ' .. tostring(abid) ..  ' != ' .. tostring(ab.cid))
        goto continue
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/vePartList.lua
            for _, v in pairs(parts) do
              local partName = tostring(v[2])
              local jbeamFilename = tostring(v[3])
              local partName = tostring(v[2])
              local jbeamFilename = tostring(v[3])
              v[1] = partsSearchTextCache == '' or (partName:lower():find(partsSearchTextCache, 1, true) or jbeamFilename:lower():find(partsSearchTextCache, 1, true))
            if v[1] then
              partName = tostring(v[2])
              isSelectedPart = partName == vEditor.selectedPart
              im.TableNextColumn()
              im.Selectable1("##part" .. tostring(k), true, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap))
              if im.IsItemHovered() then
              end
              editor.uiHighlightedText(tostring(v[3]), partsSearchTextCache)
                openPartWindows()
                local _, filename, _ = path.split(tostring(v[3]))
                im.SetClipboardText(filename)

              im.TextUnformatted(tostring(v[5]))
              im.TableNextRow()
        if im.MenuItem1("Open location in file explorer") then
          Engine.Platform.exploreFolder(tostring(rightClickedPart[3]))
        end

      im.TextUnformatted(tostring(partsViewCount) .. ' parts found')
      if vEditor.selectedPart then
@/lua/common/testFramework/JUnitXMLWriter.lua
    attr = {
      { type = "attribute", name = "tests", value = tostring(#testResults) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "tests", value = tostring(#testResults) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "time", value = tostring(totalDuration) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "time", value = tostring(totalDuration) },
    },
      { type = "attribute", name = "name", value = "LuaUnitTests" },
      { type = "attribute", name = "tests", value = tostring(#testResults) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "tests", value = tostring(#testResults) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "time", value = tostring(totalDuration) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "time", value = tostring(totalDuration) },
    },
        { type = "attribute", name = "name", value = result.name },
        { type = "attribute", name = "time", value = tostring(result.duration) },
      },
@/lua/ge/extensions/editor/dynamicDecals/layerTypes/path.lua
    for k, data in ipairs(layer.dataPoints) do
      im.TextUnformatted(tostring(k))
      im.SameLine()
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/scriptAI/playRecording.lua
    im.Text("No Recording found :")
    im.Text(tostring( self.pinIn.fileName.value))
  else
@/lua/ge/extensions/editor/gen/utils.lua
a[#a+1] = 9
print('??^^^^^^^^^^^ TST3:'..#a..':'..tableSize(a)..':'..tostring(a[3])..':'..tostring(a[#a]))
]]
a[#a+1] = 9
print('??^^^^^^^^^^^ TST3:'..#a..':'..tableSize(a)..':'..tostring(a[3])..':'..tostring(a[#a]))
]]
}
--	print('??++++++++++++++++++++++++++++++++++++++++++++++++ UTILS_PREPROD:'..tostring(FS:fileExists('/lua/ge/extensions/editor/gen/inprod')))
	local s,t = closestLinePoints(line[1], line[2], b, core_camera.getPosition())
--		lo('?? aDS:'..tostring(s)..':'..tostring(t))
	if s<0 or s>1 then
	local s,t = closestLinePoints(line[1], line[2], b, core_camera.getPosition())
--		lo('?? aDS:'..tostring(s)..':'..tostring(t))
	if s<0 or s>1 then
	local d,p = U.toLine(b, line)
--		lo('?? angDistSeg:'..tostring(angDist(p,b))..':'..tostring(p)..':'..tostring(b)..':'..U.vang(p,b))
--		U.out.aset[6] = {set={p}}
	local d,p = U.toLine(b, line)
--		lo('?? angDistSeg:'..tostring(angDist(p,b))..':'..tostring(p)..':'..tostring(b)..':'..U.vang(p,b))
--		U.out.aset[6] = {set={p}}
	local d,p = U.toLine(b, line)
--		lo('?? angDistSeg:'..tostring(angDist(p,b))..':'..tostring(p)..':'..tostring(b)..':'..U.vang(p,b))
--		U.out.aset[6] = {set={p}}
--		U.out.aset[6] = {set={p}}
--		U.dump(line, '>> angDistSeg:'..tostring(d)..':'..tostring(p))
	return angDist(p,b)
--		U.out.aset[6] = {set={p}}
--		U.dump(line, '>> angDistSeg:'..tostring(d)..':'..tostring(p))
	return angDist(p,b)
			for o,e in pairs(t) do
	--            lo(type(o)..':'..type(e)..':'..o..':'..tostring(e))
				t[o] = U.fromJSON(e)
		return t
--        lo('?? dump_nn:'..type(t)..':'..tostring(t))
--        return tostring(t)
--        lo('?? dump_nn:'..type(t)..':'..tostring(t))
--        return tostring(t)
	end
local function dump(t, msg, lvl, lvlma)
--		print('>> dump:'..tostring(lvlma))
  	if false and U._PRD ~= 0 then return end
	if not lvl or lvl == true then lvl = 0 end
--    lo('?? dump:'..tostring(lvl)..':'..type(t))
	if not t then
	if not t then
		lo((msg or '')..tostring(t))
		return
			for o,e in pairs(t) do
	--            lo(type(o)..':'..type(e)..':'..o..':'..tostring(e))
				local lt = U.dump(e, nil, lvl+1, lvlma)
	--            lo('?? dret:'..lt)
				s = s..'\r\n'..indent..o..' = '..tostring(lt)..','
			end
	else
--        lo('?? dump_nn:'..type(t)..':'..tostring(t))
		return tostring(t)
--        lo('?? dump_nn:'..type(t)..':'..tostring(t))
		return tostring(t)
	end
		file = io.open(s..fname, 'r')
			lo('??_________________________ toFile:'..s..fname..':'..tostring(file)..':'..obj)
		if file then
			if string.find(cnt, obj) then
					lo('?? found:'..tostring(file))
--				if file then file:close() end
local function forBackup(name)
--        lo('??+++++++++++++++++++++++++ forBackup:'..tostring(name), true)
	if not name then return end
	for _,v in pairs(arr) do
		s = s..tostring(v)..delim
	end
	if not delim then delim = '_' end
	local s = tostring(list[1])
	for o = 2,#list do
		local d = intersectsRay_Plane(line[1], line[2]-line[1], p[1], (p[2]-p[1]):cross(p[3]-p[1]))
--            U.dump(p, '?? linePlaneHit:'..d..':'..tostring(line[1])..':'..tostring(line[2]), true)
		if d < mi then mi = d end
		local d = intersectsRay_Plane(line[1], line[2]-line[1], p[1], (p[2]-p[1]):cross(p[3]-p[1]))
--            U.dump(p, '?? linePlaneHit:'..d..':'..tostring(line[1])..':'..tostring(line[2]), true)
		if d < mi then mi = d end
	if math.abs(B)
	if math.abs(B)
		p1,p2 = vec3(x1,-(A*x1+C)/B),vec3(x2,-(A*x2+C)/B)
--				lo('?? p1_2: p1:'..tostring(p1)..' p2:'..tostring(p2)..':'..tostring(a)..':'..tostring(b))
	end
		p1,p2 = vec3(x1,-(A*x1+C)/B),vec3(x2,-(A*x2+C)/B)
--				lo('?? p1_2: p1:'..tostring(p1)..' p2:'..tostring(p2)..':'..tostring(a)..':'..tostring(b))
	end
		p1,p2 = vec3(x1,-(A*x1+C)/B),vec3(x2,-(A*x2+C)/B)
--				lo('?? p1_2: p1:'..tostring(p1)..' p2:'..tostring(p2)..':'..tostring(a)..':'..tostring(b))
	end
		p1,p2 = vec3(x1,-(A*x1+C)/B),vec3(x2,-(A*x2+C)/B)
--				lo('?? p1_2: p1:'..tostring(p1)..' p2:'..tostring(p2)..':'..tostring(a)..':'..tostring(b))
	end
--		local isb = U.between(a,b,{p1},0.1)
--		lo('?? if_BETW:'..tostring(isb)..''..)
	if p1 and U.between(a,b,{p1},sence) then
	if not sense then sense = 0 end
--        lo('?? for_cross:'..tostring(a)..':'..tostring(b)..':'..tostring(c)..':'..tostring(d)) --..':'..tostring(p))
--[[
	if not sense then sense = 0 end
--        lo('?? for_cross:'..tostring(a)..':'..tostring(b)..':'..tostring(c)..':'..tostring(d)) --..':'..tostring(p))
--[[
	if not sense then sense = 0 end
--        lo('?? for_cross:'..tostring(a)..':'..tostring(b)..':'..tostring(c)..':'..tostring(d)) --..':'..tostring(p))
--[[
	if not sense then sense = 0 end
--        lo('?? for_cross:'..tostring(a)..':'..tostring(b)..':'..tostring(c)..':'..tostring(d)) --..':'..tostring(p))
--[[
	if not sense then sense = 0 end
--        lo('?? for_cross:'..tostring(a)..':'..tostring(b)..':'..tostring(c)..':'..tostring(d)) --..':'..tostring(p))
--[[
		local rc,rd = ((a+b)/2-c):length(),((a+b)/2-d):length()
--			lo('?? l2s:'..tostring(c)..':'..tostring(d))
		return rc < rd and c or d,rc < rd and 0 or 1,true
		local rc,rd = ((a+b)/2-c):length(),((a+b)/2-d):length()
--			lo('?? l2s:'..tostring(c)..':'..tostring(d))
		return rc < rd and c or d,rc < rd and 0 or 1,true
	local x,y = lineCross(a, b, c, d)
--		lo('?? l2s:'..tostring(x)..':'..tostring(y))
	local p = vec3(x,y)
	local x,y = lineCross(a, b, c, d)
--		lo('?? l2s:'..tostring(x)..':'..tostring(y))
	local p = vec3(x,y)
	a = U.proj2D(a)
--        U.dump(base, '>> polyCross:'..tostring(a)..':'..tostring(dir:normalized()))
	local ahit = {}
	a = U.proj2D(a)
--        U.dump(base, '>> polyCross:'..tostring(a)..':'..tostring(dir:normalized()))
	local ahit = {}
	for i=1,#base do
--            lo('?? if_HIT:'..i..':'..tostring(U.proj2D(base[i]))..':'..tostring(U.proj2D(U.mod(i+1,base))))
		local p = U.line2seg(a, a + dir, U.proj2D(base[i]), U.proj2D(U.mod(i+1,base)))
	for i=1,#base do
--            lo('?? if_HIT:'..i..':'..tostring(U.proj2D(base[i]))..':'..tostring(U.proj2D(U.mod(i+1,base))))
		local p = U.line2seg(a, a + dir, U.proj2D(base[i]), U.proj2D(U.mod(i+1,base)))
		local l = dp:length()
--            lo('?? if_Z:'..i..':'..tostring((U.mod(p[1]+1,base)-U.mod(p[1],base)):cross(dp)))
		if dir:dot(dp) < 0 and l < mileft then
			end
--            lo('?? for_LEFT:'..tostring((U.mod(p[1]+1,base)-U.mod(p[1],base)):cross(dp)))
--            mileft = l
			end
--            lo('?? for_RIGHT:'..tostring((U.mod(p[1]+1,base)-U.mod(p[1],base)):cross(dp)))
--            mileft = l
				if dbg then
					lo('>>************ forCross:'..tostring(v), true)
--                    U.dump(vinfo, '>>************ forCross:'..tostring(v)..':'..#v4e)
					lo('>>************ forCross:'..tostring(v), true)
--                    U.dump(vinfo, '>>************ forCross:'..tostring(v)..':'..#v4e)
				end
						if i == 2 then
--                            lo('?? if_CROSS:'..tostring(p)..':'..tostring(p+v)..':'..tostring(e[1])..':'..tostring(e[2]), true)
						end
						if i == 2 then
--                            lo('?? if_CROSS:'..tostring(p)..':'..tostring(p+v)..':'..tostring(e[1])..':'..tostring(e[2]), true)
						end
						if i == 2 then
--                            lo('?? if_CROSS:'..tostring(p)..':'..tostring(p+v)..':'..tostring(e[1])..':'..tostring(e[2]), true)
						end
						if i == 2 then
--                            lo('?? if_CROSS:'..tostring(p)..':'..tostring(p+v)..':'..tostring(e[1])..':'..tostring(e[2]), true)
						end
						end
--                        if dbg then U.dump(e4v[i], '?? for_E:'..i..':'..tostring(c)) end
--                        if dbg then lo('?? for_E:'..i..':'..e4v[i][1].ind..':'..e4v[i][2].ind..':'..tostring(c), true) end
--                        if dbg then U.dump(e4v[i], '?? for_E:'..i..':'..tostring(c)) end
--                        if dbg then lo('?? for_E:'..i..':'..e4v[i][1].ind..':'..e4v[i][2].ind..':'..tostring(c), true) end
					if dbg and c then
					if dbg and c then
--                        U.dump(e4v[i], '??+++ for_e:'..i..':'..tostring(c))
--                        U.dump(e, '??+++ for_e:'..i..':'..tostring(c))
--                        U.dump(e4v[i], '??+++ for_e:'..i..':'..tostring(c))
--                        U.dump(e, '??+++ for_e:'..i..':'..tostring(c))
					end
			end
			if dbg then lo('<<************ forCross:'..tostring(cmi)..' d:'..tostring(dmi)..' isend:'..tostring(isend), true) end
		end
			end
			if dbg then lo('<<************ forCross:'..tostring(cmi)..' d:'..tostring(dmi)..' isend:'..tostring(isend), true) end
		end
			end
			if dbg then lo('<<************ forCross:'..tostring(cmi)..' d:'..tostring(dmi)..' isend:'..tostring(isend), true) end
		end
		if isdupe then
				if istest then U.dump(e4v[imi], '??__________________ DUPE:'..tostring(cmi)..':'..tostring(imi)) end
			v4e[k].isdupe = true
		if isdupe then
				if istest then U.dump(e4v[imi], '??__________________ DUPE:'..tostring(cmi)..':'..tostring(imi)) end
			v4e[k].isdupe = true
		end
--            lo('?? post_CROSS:'..k..':'..tostring(cmi)..':'..tostring(isend))
			if v4e[k].ij[1] == 2 and v4e[k].ij[2] ==1 then
		end
--            lo('?? post_CROSS:'..k..':'..tostring(cmi)..':'..tostring(isend))
			if v4e[k].ij[1] == 2 and v4e[k].ij[2] ==1 then
			if v4e[k].ij[1] == 2 and v4e[k].ij[2] ==1 then
				lo('?? for_2:'..k..' cmi:'..tostring(cmi)..':'..tostring(isend))
			end
			if v4e[k].ij[1] == 2 and v4e[k].ij[2] ==1 then
				lo('?? for_2:'..k..' cmi:'..tostring(cmi)..':'..tostring(isend))
			end
			local d = (cmi-ae[imi][1]):length()/(ae[imi][2]-ae[imi][1]):length()
--                U.dump(e4v[imi], '?? v:'..k..' to:'..tostring(d))
			e4v[imi][#e4v[imi]+1] = {ind = k, d = d, done = 0}
			v4e[k][#v4e[k]+1] = imi
--                U.dump(v4e[k], '?? v___:'..k..' to:'..tostring(d)..':'..imi)
		elseif imi then
		elseif imi then
--            U.dump(ae[imi], '?? for_cross: k='..k..' ie:'..imi..':'..tostring(p))
			-- edges connecting loops
					if isend then
--                        U.dump(e4v[#e4v], '??********************* new_e4v:'..#v4e..':'..tostring(isend))
					end
		end
--            U.dump(ima, '<< stepFrom:'..tostring(ima[1].ind))
		if ima then
--            ima.done = true
			if istest then lo('<< stepFrom:'..tostring(ima[1].ind), true) end
		else
						end
							lo('??+++++ next:'..tostring(inxt)..' ext:'..pext..'>'..tostring(ext)..':'..inext)
--                        rc[#rc+1] = inext
						end
							lo('??+++++ next:'..tostring(inxt)..' ext:'..pext..'>'..tostring(ext)..':'..inext)
--                        rc[#rc+1] = inext
			local ist = index(ast,st)[1]
--                lo('?? for_stamp:'..stamp({arc[k][1],arc[k][2],arc[k][3],arc[k][4]})..':'..tostring(ist), true)
			if not ist then ist = 0 end
	--        if not ist then ist = 0 end
	--            lo('?? for_rc:'..k..':'..tostring(ist)..':'..stamp({arc[k][1],arc[k][2],arc[k][3],arc[k][4]}), true)
	--[[
					local vlist = e4v[e]
					U.dump(vlist, '?? for_VLIST:'..j..':'..iv..':'..tostring(rc[#rc]))
					local ind = index(vlist, iv, 'ind')[1]
							adir[#adir+1] = {iv=vlist[ind-1].ind, v = (v4e[vlist[ind-1].ind].p - rc[#rc]):normalized()}
								lo('?? for_p:'..tostring(v4e[vlist[ind-1].ind].p), true)
						end
					end
					U.dump(adir, '?? for_DIR:'..k..':'..tostring(iv))
					break
						for jr = 2,#pth do
--                                lo('?? for_step: i='..i..' ir='..ir..' j='..j..' jr='..jr..':'..tostring(p)..':'..tostring(U.mod(j-1,loop))..':'..tostring(pth[jr])..':'..tostring(pth[jr-1]))
							c = line2seg(p, p+v, pth[jr], pth[jr-1])
						for jr = 2,#pth do
--                                lo('?? for_step: i='..i..' ir='..ir..' j='..j..' jr='..jr..':'..tostring(p)..':'..tostring(U.mod(j-1,loop))..':'..tostring(pth[jr])..':'..tostring(pth[jr-1]))
							c = line2seg(p, p+v, pth[jr], pth[jr-1])
						for jr = 2,#pth do
--                                lo('?? for_step: i='..i..' ir='..ir..' j='..j..' jr='..jr..':'..tostring(p)..':'..tostring(U.mod(j-1,loop))..':'..tostring(pth[jr])..':'..tostring(pth[jr-1]))
							c = line2seg(p, p+v, pth[jr], pth[jr-1])
						for jr = 2,#pth do
--                                lo('?? for_step: i='..i..' ir='..ir..' j='..j..' jr='..jr..':'..tostring(p)..':'..tostring(U.mod(j-1,loop))..':'..tostring(pth[jr])..':'..tostring(pth[jr-1]))
							c = line2seg(p, p+v, pth[jr], pth[jr-1])
							c = line2seg(p, p+v, pth[1], pth[#pth])
--                                lo('?? for_TRY: c='..tostring(c)..' p='..tostring(p)..' v:'..tostring(v))
							if c and v:dot(p-c) < 0 then
							c = line2seg(p, p+v, pth[1], pth[#pth])
--                                lo('?? for_TRY: c='..tostring(c)..' p='..tostring(p)..' v:'..tostring(v))
							if c and v:dot(p-c) < 0 then
							c = line2seg(p, p+v, pth[1], pth[#pth])
--                                lo('?? for_TRY: c='..tostring(c)..' p='..tostring(p)..' v:'..tostring(v))
							if c and v:dot(p-c) < 0 then
			end
--                lo('??=== for_cmi:'..j..' p:'..tostring(p)..' c:'..tostring(cmi))
			if cmi then
			end
--                lo('??=== for_cmi:'..j..' p:'..tostring(p)..' c:'..tostring(cmi))
			if cmi then
local function segNear(p, v, ae, push)
	lo('>> segNear:'..tostring(p)..':'..tostring(v))
	local dmi,imi,cmi = math.huge
local function segNear(p, v, ae, push)
	lo('>> segNear:'..tostring(p)..':'..tostring(v))
	local dmi,imi,cmi = math.huge
	for i,e in pairs(ae) do
	--            lo('?? for_edge:'..i..':'..tostring(e[1])..':'..tostring(e[2]))
		if (p-e[1]):length() > 0 and (p-e[2]):length() > 0 then
	for i,e in pairs(ae) do
	--            lo('?? for_edge:'..i..':'..tostring(e[1])..':'..tostring(e[2]))
		if (p-e[1]):length() > 0 and (p-e[2]):length() > 0 then
	end
		dump(ae[imi], '?? segNear:'..tostring(push)..':'..tostring(p)..'>'..tostring(cmi)..':'..#ae)
end
	end
		dump(ae[imi], '?? segNear:'..tostring(push)..':'..tostring(p)..'>'..tostring(cmi)..':'..#ae)
end
	end
		dump(ae[imi], '?? segNear:'..tostring(push)..':'..tostring(p)..'>'..tostring(cmi)..':'..#ae)
end
		for j,p in pairs(loop) do
--                lo('?? for_p:'..j..':'..tostring(p))
--                lo('?? for_p:'..j..':'..tostring(p)..':'..tostring(U.mod(j-1,loop)))
--                lo('?? for_p:'..j..':'..tostring(p))
--                lo('?? for_p:'..j..':'..tostring(p)..':'..tostring(U.mod(j-1,loop)))
--                lo('?? for_p:'..j..':'..tostring(p))
--                lo('?? for_p:'..j..':'..tostring(p)..':'..tostring(U.mod(j-1,loop)))
		end
--            lo('?? if_DROP:'..j..':'..tostring(todrop))
		if not todrop then
			if dbg then
				lo('?? PS:'..j..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
			end
			if dbg then
				lo('?? PS:'..j..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
			end
U.spline2plane = function(apos, ap, adist)
	lo('>> spline2plane:'..tostring(apos)..':'..tostring(ap)..':'..tostring(adist))
	local av = {}
U.spline2plane = function(apos, ap, adist)
	lo('>> spline2plane:'..tostring(apos)..':'..tostring(ap)..':'..tostring(adist))
	local av = {}
U.spline2plane = function(apos, ap, adist)
	lo('>> spline2plane:'..tostring(apos)..':'..tostring(ap)..':'..tostring(adist))
	local av = {}
			local b,d = U.between(a,b,{pproj}, small_dist)
--				lo('?? for_pb:'.._..':'..i..':'..tostring(b)..':'..d)
			if b then
		local crs = u:normalized():cross(v:normalized()).z
--            lo('>> vang:'..tostring(signed)..':'..(u:normalized()-v:normalized()):length())
		if (u:normalized()-v:normalized()):length() < 0.00000001 then return 0 end
	end
--        lo('?? vang:'..tostring(u)..':'..tostring(v)..':'..tostring(math.acos(u:dot(v)/u:length()/v:length())))
	local cs = u:dot(v)/u:length()/v:length()
	end
--        lo('?? vang:'..tostring(u)..':'..tostring(v)..':'..tostring(math.acos(u:dot(v)/u:length()/v:length())))
	local cs = u:dot(v)/u:length()/v:length()
	end
--        lo('?? vang:'..tostring(u)..':'..tostring(v)..':'..tostring(math.acos(u:dot(v)/u:length()/v:length())))
	local cs = u:dot(v)/u:length()/v:length()
	local cs = u:dot(v)/u:length()/v:length()
--    if dbg then lo('?? vang:'..tostring(cs)..':'..tostring(cs+1)..':'..tostring(cs+1==0)) end
--`        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
	local cs = u:dot(v)/u:length()/v:length()
--    if dbg then lo('?? vang:'..tostring(cs)..':'..tostring(cs+1)..':'..tostring(cs+1==0)) end
--`        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
	local cs = u:dot(v)/u:length()/v:length()
--    if dbg then lo('?? vang:'..tostring(cs)..':'..tostring(cs+1)..':'..tostring(cs+1==0)) end
--`        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
--    if dbg then lo('?? vang:'..tostring(cs)..':'..tostring(cs+1)..':'..tostring(cs+1==0)) end
--`        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
--        if dbg then lo('?? vang:'..tostring(u)..':'..tostring(v)..':'..tostring(cs)..':'..tostring(math.acos(cs))) end
--    if dbg then lo('?? vang:'..tostring(cs)..':'..tostring(cs+1)..':'..tostring(cs+1==0)) end
--`        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
--        if dbg then lo('?? vang:'..tostring(u)..':'..tostring(v)..':'..tostring(cs)..':'..tostring(math.acos(cs))) end
--`        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
--        if dbg then lo('?? vang:'..tostring(u)..':'..tostring(v)..':'..tostring(cs)..':'..tostring(math.acos(cs))) end
	if math.abs(cs+1)<0.0000001 then
--`        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
--        if dbg then lo('?? vang:'..tostring(u)..':'..tostring(v)..':'..tostring(cs)..':'..tostring(math.acos(cs))) end
	if math.abs(cs+1)<0.0000001 then
--`        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
--        if dbg then lo('?? vang:'..tostring(u)..':'..tostring(v)..':'..tostring(cs)..':'..tostring(math.acos(cs))) end
	if math.abs(cs+1)<0.0000001 then
--`        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
--        if dbg then lo('?? vang:'..tostring(u)..':'..tostring(v)..':'..tostring(cs)..':'..tostring(math.acos(cs))) end
	if math.abs(cs+1)<0.0000001 then
	if math.abs(cs+1)<0.0000001 then
--        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
		return math.pi
	if math.abs(cs+1)<0.0000001 then
--        lo('?? vang:'..tostring(cs)..':'..tostring(cs==-1))
		return math.pi
		local vn = -(rc[2]-rc[1]):cross(rc[#rc]-rc[1])
--        lo('?? inRC_vn:'..tostring(vn))
--		local vn = (rc[3]-rc[2]):cross(rc[2]-rc[1])
          if dbg then
            lo('?? inRC_vv:'..j..':'..tostring(rc[j])..' p:'..tostring(p)..' a:'..tostring(p-rc[j])..' b:'..tostring(mod(j+1,rc)-rc[j]))
          end
          if dbg then
            lo('?? inRC_vv:'..j..':'..tostring(rc[j])..' p:'..tostring(p)..' a:'..tostring(p-rc[j])..' b:'..tostring(mod(j+1,rc)-rc[j]))
          end
          if dbg then
            lo('?? inRC_vv:'..j..':'..tostring(rc[j])..' p:'..tostring(p)..' a:'..tostring(p-rc[j])..' b:'..tostring(mod(j+1,rc)-rc[j]))
          end
          if dbg then
            lo('?? inRC_vv:'..j..':'..tostring(rc[j])..' p:'..tostring(p)..' a:'..tostring(p-rc[j])..' b:'..tostring(mod(j+1,rc)-rc[j]))
          end
			end
--            lo('?? ifcross:'..j..':'..tostring())
		end
			d1 = p:distanceToLine(rc[1],rc[2]) + p:distanceToLine(rc[3],rc[4]) - rc[1]:distanceToLine(rc[3],rc[4])
	--                dump(rc, '?? for_rc1:'..i..' d:'..d1..':'..tostring(p:distanceToLine(rc[1],rc[2]))..':'..tostring(p:distanceToLine(rc[3],rc[4]))..':'..tostring(rc[1]:distanceToLine(rc[3],rc[4])))
			if p:distanceToLine(rc[1],rc[2]) + p:distanceToLine(rc[3],rc[4]) < rc[1]:distanceToLine(rc[3],rc[4]) + miss then
			d1 = p:distanceToLine(rc[1],rc[2]) + p:distanceToLine(rc[3],rc[4]) - rc[1]:distanceToLine(rc[3],rc[4])
	--                dump(rc, '?? for_rc1:'..i..' d:'..d1..':'..tostring(p:distanceToLine(rc[1],rc[2]))..':'..tostring(p:distanceToLine(rc[3],rc[4]))..':'..tostring(rc[1]:distanceToLine(rc[3],rc[4])))
			if p:distanceToLine(rc[1],rc[2]) + p:distanceToLine(rc[3],rc[4]) < rc[1]:distanceToLine(rc[3],rc[4]) + miss then
			d1 = p:distanceToLine(rc[1],rc[2]) + p:distanceToLine(rc[3],rc[4]) - rc[1]:distanceToLine(rc[3],rc[4])
	--                dump(rc, '?? for_rc1:'..i..' d:'..d1..':'..tostring(p:distanceToLine(rc[1],rc[2]))..':'..tostring(p:distanceToLine(rc[3],rc[4]))..':'..tostring(rc[1]:distanceToLine(rc[3],rc[4])))
			if p:distanceToLine(rc[1],rc[2]) + p:distanceToLine(rc[3],rc[4]) < rc[1]:distanceToLine(rc[3],rc[4]) + miss then
				d2 = p:distanceToLine(rc[2],rc[3]) + p:distanceToLine(rc[4],rc[1]) - rc[1]:distanceToLine(rc[2],rc[3])
	--                dump(rc, '?? for_rc2:'..i..' d:'..d2..':'..tostring(p:distanceToLine(rc[2],rc[3]))..':'..tostring(p:distanceToLine(rc[4],rc[1]))..':'..tostring(rc[1]:distanceToLine(rc[2],rc[3])))
				if p:distanceToLine(rc[2],rc[3]) + p:distanceToLine(rc[4],rc[1]) < rc[1]:distanceToLine(rc[2],rc[3]) + miss then
				d2 = p:distanceToLine(rc[2],rc[3]) + p:distanceToLine(rc[4],rc[1]) - rc[1]:distanceToLine(rc[2],rc[3])
	--                dump(rc, '?? for_rc2:'..i..' d:'..d2..':'..tostring(p:distanceToLine(rc[2],rc[3]))..':'..tostring(p:distanceToLine(rc[4],rc[1]))..':'..tostring(rc[1]:distanceToLine(rc[2],rc[3])))
				if p:distanceToLine(rc[2],rc[3]) + p:distanceToLine(rc[4],rc[1]) < rc[1]:distanceToLine(rc[2],rc[3]) + miss then
				d2 = p:distanceToLine(rc[2],rc[3]) + p:distanceToLine(rc[4],rc[1]) - rc[1]:distanceToLine(rc[2],rc[3])
	--                dump(rc, '?? for_rc2:'..i..' d:'..d2..':'..tostring(p:distanceToLine(rc[2],rc[3]))..':'..tostring(p:distanceToLine(rc[4],rc[1]))..':'..tostring(rc[1]:distanceToLine(rc[2],rc[3])))
				if p:distanceToLine(rc[2],rc[3]) + p:distanceToLine(rc[4],rc[1]) < rc[1]:distanceToLine(rc[2],rc[3]) + miss then
	local r = math.abs(h/math.cos(U.vang(dir,norm)))
--		lo('?? onPlane:'..r..':'..h..':'..tostring(dir)..' p:'..tostring(p)..' norm:'..tostring(norm)..' cam:'..tostring(campos))
	local r = math.abs(h/math.cos(U.vang(dir,norm)))
--		lo('?? onPlane:'..r..':'..h..':'..tostring(dir)..' p:'..tostring(p)..' norm:'..tostring(norm)..' cam:'..tostring(campos))
	local r = math.abs(h/math.cos(U.vang(dir,norm)))
--		lo('?? onPlane:'..r..':'..h..':'..tostring(dir)..' p:'..tostring(p)..' norm:'..tostring(norm)..' cam:'..tostring(campos))
	local r = math.abs(h/math.cos(U.vang(dir,norm)))
--		lo('?? onPlane:'..r..':'..h..':'..tostring(dir)..' p:'..tostring(p)..' norm:'..tostring(norm)..' cam:'..tostring(campos))
	local d = intersectsRay_Plane(campos, dirhit, p, norm)
--		lo('?? onPlane:'..d..':'..tostring(dirhit)..':'..tostring(p)..':'..tostring(norm)..':'..tostring(campos))
	local d = intersectsRay_Plane(campos, dirhit, p, norm)
--		lo('?? onPlane:'..d..':'..tostring(dirhit)..':'..tostring(p)..':'..tostring(norm)..':'..tostring(campos))
	local d = intersectsRay_Plane(campos, dirhit, p, norm)
--		lo('?? onPlane:'..d..':'..tostring(dirhit)..':'..tostring(p)..':'..tostring(norm)..':'..tostring(campos))
	local d = intersectsRay_Plane(campos, dirhit, p, norm)
--		lo('?? onPlane:'..d..':'..tostring(dirhit)..':'..tostring(p)..':'..tostring(norm)..':'..tostring(campos))
			v2 = -v1:cross(vec3(0, 0, 1))
--            lo('?? NEW_V2:'..tostring(v2))
		end
			v1 = -v2:cross(vec3(0, 0, 1))
--            lo('?? NEW_V1:'..tostring(v1))
		end
--                if (b - bpost):length() == 0 then
--                    lo('??_____ polyMargin:'..tostring((b - bpost):normalized()))
--                end
		if v2:cross(v1):length() < small_val then
--                lo('??*********************************** polyMargin:'..i..':'..tostring(v1))
			dp = v1:cross(vec3(0,0,1))*margin
@/lua/common/libs/StackTracePlus/StackTracePlus.lua
  if type(value) == "userdata" or type(value) == "cdata" then
    -- we avoid inspecting inside these values: tostring() could crash to desktop when the object was deleted in C side (for example, when __tostring() accesses an invalid mem address)
    return type(value)..": (...)"
    if not file then
      print("file not found: "..tostring(err))    -- whoops!
      return "?"
    elseif type(value) == "boolean" then
      self:add_f("%s%s = boolean: %s\n", prefix, name, tostring(value))
    elseif type(value) == "string" then
      if _M.max_string_output_len > 0 and stringlen > _M.max_string_output_len then
        self:add_f("%s%s = string[%d/%d]: %q (more...)\n", prefix, name, _M.max_string_output_len, stringlen, string.sub(tostring(value), 1, _M.max_string_output_len))
      else
      if info.what == "C" then
        self:add_f("%s%s = C %s\n", prefix, name, (fun_name and ("function: " .. fun_name) or tostring(value)))
      else
    elseif type(value) == "thread" then
      self:add_f("%sthread %q = %s\n", prefix, name, tostring(value))
    else
      --for k,v in pairs(info) do print(k,v, type(v)) end
      local function_name = m_user_known_functions[info.func] or m_known_functions[info.func] or info.name or tostring(info.func)
      dumper:add_f("\n(%d) %s C function '%s'", level_to_show, info.namewhat, function_name)
      dumper:add_f("\n(%d) %s C function '%s'", level_to_show, info.namewhat, function_name)
      --dumper:add_f("%s%s = C %s\n", prefix, name, (m_known_functions[value] and ("function: " .. m_known_functions[value]) or tostring(value)))
    elseif info.what == "tail" then
      --for k,v in pairs(info) do print(k,v, type(v)) end
      local function_name = m_user_known_functions[info.func] or m_known_functions[info.func] or info.name or tostring(info.func)
      dumper:add_f("(%d) %s C function '%s'\n", level_to_show, info.namewhat, function_name)
      dumper:add_f("(%d) %s C function '%s'\n", level_to_show, info.namewhat, function_name)
      --dumper:add_f("%s%s = C %s\n", prefix, name, (m_known_functions[value] and ("function: " .. m_known_functions[value]) or tostring(value)))
    elseif info.what == "tail" then
@/lua/ge/extensions/flowgraph/nodes/gameplay/removeOtherVehicles.lua
    self:updatePins(self.count, ptr[0])
    reason = "Changed Value count to " .. tostring(ptr[0])
  end
    self.onlyDrivableVehs = ptr[0]
    reason = "Changed Value onlyDrivableVehs to " .. tostring(ptr[0])
  end
    self.onlyFlowgraphVehs = ptr[0]
    reason = "Changed Value onlyFlowgraphVehs to " .. tostring(ptr[0])
  end
@/lua/common/libs/luasocket/socket/socket.lua
        local f = table[name or "nil"]
        if not f then base.error("unknown key (".. base.tostring(name) ..")", 3)
        else return f(opt1, opt2) end
@/lua/common/libs/ezSVG/EzSVG.lua
        if v ~= "" and v ~= nil then
          ret = string.format("%s%s=%q ", ret, k, tostring(v))
        end
        if v ~= "" and v ~= nil and tbl[k] == nil then
          ret = string.format("%s%s=%q ", ret, k, tostring(v))
        end

  return tostring(tbl)
end
  ret["setText"] = function(tbl, text)
    if type(text) == "number" then text = tostring(text) end
    if type(text) == "string" then
@/lua/ge/extensions/editor/dynamicDecals/layerTypes/decal.lua
  im.NextColumn()
  im.TextUnformatted(tostring(layer.zBufferDepth))
  im.NextColumn()
@/lua/ge/extensions/career/modules/partInventory.lua
  for inventoryId, vehicle in pairs(vehicles) do
    data.brokenVehicleInventoryIds[tostring(inventoryId)] = career_modules_insurance_insurance.inventoryVehNeedsRepair(inventoryId)
    vehicleUiData.thumbnail = career_modules_inventory.getVehicleThumbnail(inventoryId) .. "?" .. (vehicleUiData.dirtyDate or "")
    vehiclesUiData[tostring(inventoryId)] = vehicleUiData
  end
@/lua/ge/extensions/core/chat.lua
  s:hook('OnBan', function(channel, message)
    log('D', 'chat', 'banned from ' .. tostring(channel))
    statusMsg = 'You are banned.'
  s:hook('OnKick', function(channel, kicked, prefix, reason)
    log('D', 'chat', 'kicked from ' .. tostring(channel))
    statusMsg = 'You got kicked, trying to rejoin'
    if user.nick == wishedNickName then
      statusMsg = 'joined channel ' .. tostring(channel)
      localUser = user
@/lua/ge/extensions/scenario/positionGoal.lua
    if not endobj then
      log('E', 'In '..tostring(scenario.name), ' this value ' ..tostring(instance.value.endPoint) .. ' is not an object in scenetree')
      goto continue
    if not endobj then
      log('E', 'In '..tostring(scenario.name), ' this value ' ..tostring(instance.value.endPoint) .. ' is not an object in scenetree')
      goto continue
    if instance.value.purpose and type(instance.value.purpose)~="string" then
      log('E', 'In '..tostring(scenario.name),'purpose is missing in json file or purpose has wrong type ')
      goto continue
@/lua/vehicle/powertrain/combustionEngine.lua
      --cache the required output torque and AV property names for fast access
      device.outputTorqueNames[i] = "outputTorque" .. tostring(i)
      device.outputAVNames[i] = "outputAV" .. tostring(i)
      device.outputTorqueNames[i] = "outputTorque" .. tostring(i)
      device.outputAVNames[i] = "outputAV" .. tostring(i)
      device[device.outputTorqueNames[i]] = 0
@/lua/ge/extensions/ui/console.lua
  local status,err = pcall(function() string.match("", pat) end )
  if not status then filterErr = string.match(tostring(err), "%[.*%]:%d*: ?(.*)") end
  return status
      if type(t.errors) == 'number' and t.errors > 0 then
        im.TextColored(im.ImVec4(1.0, 0.0, 0.0, 1.0), tostring(t.errors) .. 'E ')
        --im.SameLine()
      if type(t.warnings) == 'number' and t.warnings > 0 then
        im.TextColored(im.ImVec4(1.0, 1.0, 0.0, 1.0), tostring(t.warnings) .. 'W')
      end
function ConsoleInputCallback(data)
  --log('D', 'console', '>>> inputCallback 1 - ' .. dumps(data) .. ' / ' .. tostring(#history))
  if data.EventFlag == im.InputTextFlags_CallbackHistory then
  else
    t = tostring(timer)
  end
  if #slashed == 0 then slashed[1]="" end --fix for empty print
  if tostring(slashed[1]):len() > 4096 then
    logs[logsTail] = {t,lvl,origin,tostring(slashed[1]):sub(1,4096)} --trim so we save memory and don't stress other part of code
  if tostring(slashed[1]):len() > 4096 then
    logs[logsTail] = {t,lvl,origin,tostring(slashed[1]):sub(1,4096)} --trim so we save memory and don't stress other part of code
  else
      -- logs[logsTail] = slashed[i]
      if tostring(slashed[i]):len() > 4096 then
        logs[logsTail] = {t,lvl,origin,tostring(slashed[i]):sub(1,4096)} --trim so we save memory and don't stress other part of code
      if tostring(slashed[i]):len() > 4096 then
        logs[logsTail] = {t,lvl,origin,tostring(slashed[i]):sub(1,4096)} --trim so we save memory and don't stress other part of code
      else
      im.SameLine()
      im.TextColored(im.ImVec4(1.0, 0.0, 0.0, 1.0), tostring(filterErr) )
      im.PopStyleColor()
      --       for i,v in ipairs(l) do
      --         im.TextColored(lcol,"%s",tostring(v) )
      --         im.NextColumn()

      --       im.TextColored(lcol,"%s",tostring(v) )
      --       if v ~= 2 and im.GetContentRegionAvailWidth() < im.CalcTextSize(tostring(v)).x then
      --       im.TextColored(lcol,"%s",tostring(v) )
      --       if v ~= 2 and im.GetContentRegionAvailWidth() < im.CalcTextSize(tostring(v)).x then
      --         im.tooltip(tostring(v))
      --       if v ~= 2 and im.GetContentRegionAvailWidth() < im.CalcTextSize(tostring(v)).x then
      --         im.tooltip(tostring(v))
      --       end
      -- for i = displayStart[0],displayEnd[0] do
      --   -- im.TextUnformatted(tostring(i))
      --   local l = logs[i+logsHead]

      --       im.TextColored(lcol,"%s",tostring(v) )
      --       if v ~= 2 and im.GetContentRegionAvailWidth() < im.CalcTextSize(tostring(v)).x then
      --       im.TextColored(lcol,"%s",tostring(v) )
      --       if v ~= 2 and im.GetContentRegionAvailWidth() < im.CalcTextSize(tostring(v)).x then
      --         im.tooltip(tostring(v))
      --       if v ~= 2 and im.GetContentRegionAvailWidth() < im.CalcTextSize(tostring(v)).x then
      --         im.tooltip(tostring(v))
      --       end
          interestingLines["currentDisplayLines"] = {listClip.DisplayStart,listClip.DisplayEnd}
          -- im.TextUnformatted(tostring(i))
          -- ::looklineagain::

              -- im.TextColored(lcol,"%s",tostring(v))
              local txtwidth = im.CalcTextSize(tostring(v)).x
              -- im.TextColored(lcol,"%s",tostring(v))
              local txtwidth = im.CalcTextSize(tostring(v)).x
              if v ~= 2 and im.GetContentRegionAvailWidth() < txtwidth then
              if v ~= 2 and im.GetContentRegionAvailWidth() < txtwidth then
                im.TextColored(lcol,string.format("%s", tostring(v):sub(1,256) ))
                txtwidth = txtwidth * (1/fontConsoleFact[0])
                local vp = im.GetWindowViewport()
                local chunkSize = tostring(v):len() * vp.Size.x / txtwidth
                if txtwidth > vp.Size.x or tostring(v):len()>chunkSize then
                local chunkSize = tostring(v):len() * vp.Size.x / txtwidth
                if txtwidth > vp.Size.x or tostring(v):len()>chunkSize then
                  local bt = tostring(v)
                if txtwidth > vp.Size.x or tostring(v):len()>chunkSize then
                  local bt = tostring(v)
                  local chunk = ""
                    chunk = chunk.."\n...\nToo long to display, check the log file"
                    --chunk = chunk.."\nlsize="..tostring(v):len()
                  end
                  if tooltipOnLongTxt[0] then
                    im.tooltip(tostring(v))
                  end
              else
                im.TextColored(lcol, "%s", tostring(v))
              end

          --print(" CMD = " .. tostring(cmd))
          if comboCurrentItem[0] == 0 then
          if comboCurrentItem[0] == 0 then
            --table.insert(console_log_buffer, {'i', "> " .. tostring(cmd)})
            if sandboxCmd[0] then
              local res, out = executeLuaSandboxed(cmd, 'GEConsole')
              --print(" RES = " .. tostring(res))
              --print(" OUT = " .. dumps(out))
              if res then
                --table.insert(console_log_buffer, {'r', tostring(res)})
                if type(res)=="string" and res:sub(1,7)== "Error: " then
                for _, le in ipairs(out) do
                  --table.insert(console_log_buffer, {'o', tostring(le)})
                  print(le)
            if not v then log("E","exec","Selected vehicle dosn't exist");refreshCombo();goto skipcmd end
            log("I", "exec", "veh "..tostring(vid).." < "..dumps(cmd))
            v:queueLuaCommand(cmd)
local function vehStrInfo(vobj)
  local strI = tostring(vobj:getId())
  strI = strI..", "..vobj:getJBeamFilename()
    local vehConfig = string.match(vobj.partConfig, "([^./]*).pc")
    strI = strI..", "..tostring(vehConfig)
  end
  if data.consoleInputField then
    ffi.copy(consoleInputField, tostring(data.consoleInputField))
  end
@/lua/vehicle/main.lua
print = function(...)
  log("A", "print", tostring(...))
  -- log('A', "print", debug.traceback()) -- find where print is used
function updateCorePhysicsStepEnabled()
  -- print("Controller: " .. tostring(controller.isPhysicsStepUsed()))
  -- print("Powertrain: " .. tostring(powertrain.isPhysicsStepUsed()))
  -- print("Controller: " .. tostring(controller.isPhysicsStepUsed()))
  -- print("Powertrain: " .. tostring(powertrain.isPhysicsStepUsed()))
  -- print("Wheels: " .. tostring(wheels.isPhysicsStepUsed()))
  -- print("Powertrain: " .. tostring(powertrain.isPhysicsStepUsed()))
  -- print("Wheels: " .. tostring(wheels.isPhysicsStepUsed()))
  -- print("Thrusters: " .. tostring(thrusters.isPhysicsStepUsed()))
  -- print("Wheels: " .. tostring(wheels.isPhysicsStepUsed()))
  -- print("Thrusters: " .. tostring(thrusters.isPhysicsStepUsed()))
  -- print("Hydros: " .. tostring(hydros.isPhysicsStepUsed()))
  -- print("Thrusters: " .. tostring(thrusters.isPhysicsStepUsed()))
  -- print("Hydros: " .. tostring(hydros.isPhysicsStepUsed()))
  -- print("Beamstate: " .. tostring(beamstate.isPhysicsStepUsed()))
  -- print("Hydros: " .. tostring(hydros.isPhysicsStepUsed()))
  -- print("Beamstate: " .. tostring(beamstate.isPhysicsStepUsed()))
  -- print("---")
  end
  log("D", "default.init", "spawning vehicle " .. tostring(path))
  else
    log("E", "vehicle", "invalid initData: " .. tostring(type(initData)) .. ": " .. tostring(initData))
  end
  else
    log("E", "vehicle", "invalid initData: " .. tostring(type(initData)) .. ": " .. tostring(initData))
  end
@/lua/common/libs/lunajson/lunajson/decoder.lua
  -- deal with non-standard locales
  local radixmark = match(tostring(0.5), '[^0-9]')
  local fixedtonumber = tonumber
@/lua/ge/extensions/gameplay/rally/audioManager.lua
  addToFront = addToFront or false
  -- log('I', logTag, string.format('enqueuePauseSecs: pause=%0.2fs front=%s', secs, tostring(addToFront)))
    if not pacenote.audioFname or pacenote.audioFname == '' or not FS:fileExists(pacenote.audioFname) then
      log('E', logTag, string.format("enqueueSystemPacenote: audio file not found: %s", tostring(pacenote.audioFname)))
      guihooks.message(string.format("Can't find audio file for system pacenote '%s'.", pacenote.name), 5)
@/lua/ge/extensions/gameplay/rally/notebook/pacenoteWaypoint.lua
function C:setRoutePoint(rp)
  -- print(string.format("setRoutePoint for %s -> %s", self.name, tostring(not not rp)))
  self.routePoint = rp
@/lua/ge/extensions/editor/rallyEditor/drivelineTab.lua
    self.loadError = err or "Failed to load race path"
    log('E', logTag, 'Failed to load race path: ' .. tostring(err))
    return false
      local pointCount = self:getDrivelinePointCount()
      im.Text("Points: " .. tostring(pointCount))
      local length = self:getDrivelineLength()
    if self.drivelineV3.spline then
      im.Text("Nodes: " .. tostring(#self.drivelineV3.spline.nodes))
      if self.drivelineV3.spline.roadLength then
    if self.drivelineV3.finalDrivelinePoints then
      im.Text("Points: " .. tostring(#self.drivelineV3.finalDrivelinePoints))
@/lua/ge/extensions/core/input/actions.lua
      if vehicleActions == nil then
        log("E", "input_actions", 'unable to read json file: ' .. tostring(path))
      end
    if core_input_deprecatedActions[action] == nil then
      log('E', 'bindings', "Couldn't find action "..tostring(action).." in actions lookup table")
      return
    if debugUIEnabled then
      log('I', 'triggers', 'Executing trigger code: ' .. tostring(cmd))
    end
local function _replaceCmd(cmd, actionValue, vehicleId)
  cmd = cmd:gsub("VALUE", tostring(actionValue))
  cmd = cmd:gsub("VEHICLEID", tostring(vehicleId))
  cmd = cmd:gsub("VALUE", tostring(actionValue))
  cmd = cmd:gsub("VEHICLEID", tostring(vehicleId))
  -- TODO: improve hardcoded filter, etc
@/lua/ge/extensions/flowgraph/nodes/ui/message.lua
    --print(self.pinIn.message.value)
    --ui_message(tostring(self.pinIn.message.value), self.pinIn.duration.value or 5, self.pinIn.category.value or ("__"..self.id), self.pinIn.icon.value)
    guihooks.trigger('Message',helper)
@/lua/common/devUtils.lua
  fEnv.print = function(msg)
    --io.write("sandboxed print: " .. tostring(msg) .. "\n")
    table.insert(stdOutCache, tostring(msg))
    --io.write("sandboxed print: " .. tostring(msg) .. "\n")
    table.insert(stdOutCache, tostring(msg))
  end
    fEnv.print = print_saved
    return "Error: " .. tostring(result)
  end
  fEnv.print = print_saved
  return "Error: " .. tostring(err)
end
  if type(tbl) ~= 'table' then return end
  if visitedEntries[tostring(tbl)] then return {} end
  visitedEntries[tostring(tbl)] = true -- prevent infinite recursion
  if visitedEntries[tostring(tbl)] then return {} end
  visitedEntries[tostring(tbl)] = true -- prevent infinite recursion
  for _, entry in pairs(tbl) do
    if type(entry) == 'function' and not visitedEntries[tostring(entry)]  then
      visitedEntries[tostring(entry)] = true -- prevent infinite recursion
    if type(entry) == 'function' and not visitedEntries[tostring(entry)]  then
      visitedEntries[tostring(entry)] = true -- prevent infinite recursion
      local upvalues = _findUpValuesFromFunction(moduleTbl, entry)
local function _cleanupCloneTbl(t, tablesVisited, path)
  if tablesVisited[tostring(t)] then return tablesVisited[tostring(t)] end
  local res = {}
local function _cleanupCloneTbl(t, tablesVisited, path)
  if tablesVisited[tostring(t)] then return tablesVisited[tostring(t)] end
  local res = {}
  local res = {}
  tablesVisited[tostring(t)] = res
  tablesVisited[tostring(res)] = res
  tablesVisited[tostring(t)] = res
  tablesVisited[tostring(res)] = res
    if type(v) == 'table' then
      local newPath = path .. '/' .. tostring(k)
      local r = _cleanupCloneTbl(v, tablesVisited, newPath)
local function _createGraphviz(t, tablesVisited, path)
  if tablesVisited[tostring(t)] then return '' end
  tablesVisited[tostring(t)] = true
  if tablesVisited[tostring(t)] then return '' end
  tablesVisited[tostring(t)] = true

  local parent = tostring(t):gsub('[^a-zA-Z0-9]', '')
  local res = ''
  local res = ''
  res = res .. parent .. ' [ label = "' .. tostring(k) .. '" ];\n'
    local v = rawget(t, k)
    local newPath = path .. '_' .. tostring(v)
    newPath = newPath:gsub('[^a-zA-Z0-9]', '_')
        t.key = k
        snapshot.tablesTmp[tostring(v)] = t
      end
    if type(v) == 'table' then
      local newPath = path .. '/' .. tostring(k)
      local tblPtr = tostring(v)
      local newPath = path .. '/' .. tostring(k)
      local tblPtr = tostring(v)
      if not res[tblPtr] then res[tblPtr] = {} end
@/lua/ge/extensions/freeroam/freeroamConfigurator.lua
local function fetchSpawnPointTile(levelName, spawnPointName)
  log("I", "freeroamConfigurator", "fetchSpawnPointTile: levelName=" .. tostring(levelName) .. ", spawnPointName=" .. tostring(spawnPointName))
  local details = {}
local function fetchSpawnPointTile(levelName, spawnPointName)
  log("I", "freeroamConfigurator", "fetchSpawnPointTile: levelName=" .. tostring(levelName) .. ", spawnPointName=" .. tostring(spawnPointName))
  local details = {}
  if not success then
    log("W", "freeroamConfigurator", "Failed to get spawnpoint details: " .. tostring(levelName) .. "/" .. tostring(spawnPointName))
    return nil
  if not success then
    log("W", "freeroamConfigurator", "Failed to get spawnpoint details: " .. tostring(levelName) .. "/" .. tostring(spawnPointName))
    return nil
local function fetchVehicleTile(model, config, additionalData)
  log("I", "freeroamConfigurator", "fetchVehicleTile: model=" .. tostring(model) .. ", config=" .. tostring(config))
  if not model or not config then
local function fetchVehicleTile(model, config, additionalData)
  log("I", "freeroamConfigurator", "fetchVehicleTile: model=" .. tostring(model) .. ", config=" .. tostring(config))
  if not model or not config then
  if not success then
    log("W", "freeroamConfigurator", "Failed to get vehicle details: model=" .. tostring(model) .. ", config=" .. tostring(config))
    return nil
  if not success then
    log("W", "freeroamConfigurator", "Failed to get vehicle details: model=" .. tostring(model) .. ", config=" .. tostring(config))
    return nil
  if not tile then
    log("W", "freeroamConfigurator", "Failed to get spawnpoint details: " .. tostring(levelName) .. "/" .. tostring(spawnPointName) .. ", defaulting to " .. tostring(defaultLevelName) .. "/" .. tostring(defaultSpawnPointName))
    currentConfiguration.levelName = defaultLevelName
  if not tile then
    log("W", "freeroamConfigurator", "Failed to get spawnpoint details: " .. tostring(levelName) .. "/" .. tostring(spawnPointName) .. ", defaulting to " .. tostring(defaultLevelName) .. "/" .. tostring(defaultSpawnPointName))
    currentConfiguration.levelName = defaultLevelName
  if not tile then
    log("W", "freeroamConfigurator", "Failed to get spawnpoint details: " .. tostring(levelName) .. "/" .. tostring(spawnPointName) .. ", defaulting to " .. tostring(defaultLevelName) .. "/" .. tostring(defaultSpawnPointName))
    currentConfiguration.levelName = defaultLevelName
  if not tile then
    log("W", "freeroamConfigurator", "Failed to get spawnpoint details: " .. tostring(levelName) .. "/" .. tostring(spawnPointName) .. ", defaulting to " .. tostring(defaultLevelName) .. "/" .. tostring(defaultSpawnPointName))
    currentConfiguration.levelName = defaultLevelName
@/lua/ge/extensions/flowgraph/nodes/ui/imgui/elemental/imNumbers.lua
  local ret = nil
  local label = tostring(self.pinIn.text.value or "Number")  ..'##'.. tostring(self.id)
  local step = self.pinIn.step.value
  local ret = nil
  local label = tostring(self.pinIn.text.value or "Number")  ..'##'.. tostring(self.id)
  local step = self.pinIn.step.value
@/lua/vehicle/recovery.lua
      local rot = quatFromDir(dirFront, dirUp)
      obj:queueGameEngineLua("spawn.safeTeleport(getObjectByID("..obj:getId().."), vec3("..recPoint.pos.x..","..recPoint.pos.y..","..recPoint.pos.z.."), quat("..rot.x..","..rot.y..","..rot.z..","..rot.w.."), nil, nil, " .. tostring(moveTraffic) ..  ")")
    else
  obj:requestReset(RESET_PHYSICS)     -- fix vehicle + reset velocity
  obj:queueGameEngineLua('getObjectByID('..tostring(obj:getId())..'):resetBrokenFlexMesh()')
  setRecoveryPoint(M.homePoint, true, moveTraffic)
  --obj:setMeshNameAlpha(1, "", true) -- show everything again
  obj:queueGameEngineLua('getObjectByID('..tostring(obj:getId())..'):resetBrokenFlexMesh()')
  obj:queueGameEngineLua('be.nodeGrabber:clearVehicleFixedNodes('..tostring(obj:getId())..')')
  obj:queueGameEngineLua('getObjectByID('..tostring(obj:getId())..'):resetBrokenFlexMesh()')
  obj:queueGameEngineLua('be.nodeGrabber:clearVehicleFixedNodes('..tostring(obj:getId())..')')
  setRecoveryPoint(lastRecoveryPoint, true)
    rewindPosition = true
    obj:queueGameEngineLua('be:queueObjectLua('..tostring(obj:getId())..', "if recovery.getFreeCamActiveFlag() ~= nil then recovery.setFreeCamActiveFlag(" .. tostring(commands.isFreeCamera()) .. ") end") commands.setFreeCamera()')
    snapshotTimeSmoother:set(1)
    rewindPosition = true
    obj:queueGameEngineLua('be:queueObjectLua('..tostring(obj:getId())..', "if recovery.getFreeCamActiveFlag() ~= nil then recovery.setFreeCamActiveFlag(" .. tostring(commands.isFreeCamera()) .. ") end") commands.setFreeCamera()')
    snapshotTimeSmoother:set(1)
@/lua/ge/extensions/flowgraph/nodes/util/getLevelData.lua

  self.pinOut.devName.value = tostring(devName)
  self.pinOut.directory.value = tostring(dir)
  self.pinOut.devName.value = tostring(devName)
  self.pinOut.directory.value = tostring(dir)
  self.pinOut.path.value = tostring(levelPath)
  self.pinOut.directory.value = tostring(dir)
  self.pinOut.path.value = tostring(levelPath)
end
@/lua/ge/extensions/ui/missionInfo.lua
M.performAction = function(actionName)
  -- log('I', logTag, tostring(actionName) .. " action triggered. Looking for " .. tostring(actionName) .. " action in "..dumps(M.buttonsTable))
  if M.buttonsTable then
M.performAction = function(actionName)
  -- log('I', logTag, tostring(actionName) .. " action triggered. Looking for " .. tostring(actionName) .. " action in "..dumps(M.buttonsTable))
  if M.buttonsTable then
M.performActivityAction = function(id)
  log('I', logTag, tostring(actionName) .. " action triggered. Looking for " .. tostring(actionName) .. " action in "..dumps(M.buttonsTable))
  if M.buttonsTable then
M.performActivityAction = function(id)
  log('I', logTag, tostring(actionName) .. " action triggered. Looking for " .. tostring(actionName) .. " action in "..dumps(M.buttonsTable))
  if M.buttonsTable then
@/lua/ge/extensions/gameplay/rally/notebook/missionSettings.lua
  if not newMissionSettingsData then
    log('E', logTag, 'unable to read mission settings: ' .. tostring(self:fname()))
    return false
  if not newMissionSettingsData.notebook.filename or not FS:fileExists(notebookFname) then
    -- log('D', logTag, 'missionSetting for notebook.filename not found in mission settings file at '..tostring(self:fname()))
    local existingNotebooks = listNotebooks(self.missionDir)
  if not newMissionSettingsData then
    log('E', logTag, 'unable to read mission settings: ' .. tostring(self:fname()))
    return false
  if not FS:fileExists(self:fname()) then
    -- log('D', logTag, 'notebook.filename setting not found: ' .. tostring(newMissionSettingsData.notebook.filename))
    -- log('D', logTag, 'setting notebook.filename to default: '..rallyUtil.defaultNotebookFname)
  if not newMissionSettingsData then
    log('E', logTag, 'unable to read mission settings: ' .. tostring(self:fname()))
    return false
  --   local checkCodriverName = notebook:getCodriverByName(loadedCodriverName)
  --   log('D', logTag, 'missionSettings.codriver.name='..tostring(loadedCodriverName)..' notebook.codriver.name='..tostring(checkCodriverName and checkCodriverName.name or 'nil'))
  --   if not checkCodriverName then
  --   local checkCodriverName = notebook:getCodriverByName(loadedCodriverName)
  --   log('D', logTag, 'missionSettings.codriver.name='..tostring(loadedCodriverName)..' notebook.codriver.name='..tostring(checkCodriverName and checkCodriverName.name or 'nil'))
  --   if not checkCodriverName then
  --   if not checkCodriverName then
  --     log('W', logTag, 'missionSettings: codriver name not found in notebook: ' .. tostring(loadedCodriverName))
  --     log('D', logTag, 'setting codriver name to first codriver: '..notebook:getFirstCodriver().name)
    local checkCodriverId = notebook:getCodriverById(loadedCodriverId)
    -- log('D', logTag, 'missionSettings.codriver.id='..tostring(loadedCodriverId)..' notebook.codriver.id='..tostring(checkCodriverId and checkCodriverId.id or 'nil'))
    if not checkCodriverId then
    local checkCodriverId = notebook:getCodriverById(loadedCodriverId)
    -- log('D', logTag, 'missionSettings.codriver.id='..tostring(loadedCodriverId)..' notebook.codriver.id='..tostring(checkCodriverId and checkCodriverId.id or 'nil'))
    if not checkCodriverId then
    if not checkCodriverId then
      -- log('D', logTag, 'missionSettings: codriver id not found in notebook: ' .. tostring(loadedCodriverId))
      -- log('D', logTag, 'setting codriver id to first codriver: '..notebook:getFirstCodriver().id)
  if not newMissionSettingsData then
    log('E', logTag, 'unable to read mission settings: ' .. tostring(self:fname()))
    return false
  self:onDeserialized(newMissionSettingsData)
  -- log('I', logTag, 'loaded rally mission settings from ' .. tostring(self:fname()))
  -- if not notebook then
    -- log('E', logTag, 'unable to load notebook: ' .. tostring(err))
    -- return nil
  if err then
    log('E', logTag, 'unable to load race: ' .. tostring(err))
    return nil
--   self.drivelineMode = drivelineMode
--   print('setDrivelineMode: '..tostring(drivelineMode))
--   self:write()
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/vePartPropertyView.lua
      t.groupName = ''
      t.name = tostring(k)
      t.type = 'string'
      t.type = 'string'
      t.value = tostring(v)
      if type(v) == 'number' then
@/lua/ge/extensions/editor/roadSpline/layerMgr.lua
  decalRoad:setField("material", 0, layer.material)
  decalRoad:setField("overObjects", 0, tostring(layer.isOverObjects))
  decalRoad:setField('startEndFade', 0, string.format("%f %f", startFade, endFade)) -- Apply fade parameters for this chunk.
  dRoad:setField("material", 0, layer.material)
  dRoad:setField("overObjects", 0, tostring(layer.isOverObjects))
  dRoad:setField('startEndFade', 0, string.format("%f %f", layer.fadeIn, layer.fadeOut))
@/lua/ge/extensions/core/gamestate.lua
  local mainMenu = getMissionFilename() == ''
  log('D', logTag, 'show main menu (' .. tostring(mainMenu) .. ')')
  guihooks.trigger('ShowEntertainingBackground', mainMenu)
  local first = containsOnly(loadingScreenRequests, false)
  log('D', logTag, 'loading screen request from: ' .. tagName .. '; value before was: ' .. tostring(loadingScreenRequests[tagName]))
  if loadingScreenRequests[tagName] then log('D', logTag, 'trying to enter state we are already in: ' .. tostring(tagName)) end
  log('D', logTag, 'loading screen request from: ' .. tagName .. '; value before was: ' .. tostring(loadingScreenRequests[tagName]))
  if loadingScreenRequests[tagName] then log('D', logTag, 'trying to enter state we are already in: ' .. tostring(tagName)) end
  loadingScreenRequests[tagName] = true
    table.insert(listeners, func)
    log('D', logTag, 'ui initialised (' .. tostring(UIInitialised) .. ')')
    log('D', logTag, 'waiting for ui (' .. tostring(waitingForUIToBeInitialised) .. ')')
    log('D', logTag, 'ui initialised (' .. tostring(UIInitialised) .. ')')
    log('D', logTag, 'waiting for ui (' .. tostring(waitingForUIToBeInitialised) .. ')')
    if not UIInitialised then
    local showMainMenu = sendShowMainMenu()
    log('D', logTag, 'sending hide loading screen; showing main menu (' .. tostring(showMainMenu) .. ')')
    guihooks.trigger("LoadingScreen", {
@/lua/ge/extensions/util/resaveMaterials.lua
  local objs = scenetree.getAllObjects()
  --log('E', '', '# objects existing: ' .. tostring(#scenetree.getAllObjects()))
  for _, objName in ipairs(objs) do
  return ret
  --log('E', '', '# objects left: ' .. tostring(#scenetree.getAllObjects()))
end
    if not tableIsEmpty(objects) then
      log('I', '', 'parsing materials file: ' .. tostring(fn))
        -- the old material files can also contain other stuff ...
        log('I', '', ' * ' .. tostring(obj:getClassName()) .. ' - ' .. tostring(obj:getName()) )
        persistenceMgr:setDirty(obj, '')
        -- the old material files can also contain other stuff ...
        log('I', '', ' * ' .. tostring(obj:getClassName()) .. ' - ' .. tostring(obj:getName()) )
        persistenceMgr:setDirty(obj, '')
@/lua/ge/extensions/editor/aiViz.lua
  if camNodeSqDist < square(clamp(editor.getPreference("gizmos.visualization.visualizationDrawDistance") * 0.5, 50, 250)) then
    debugDrawer:drawText(n.pos, String(tostring(nid)), linkBaseColor)
  end
@/lua/vehicle/powertrain.lua
for i = 0, 10 do
  outputTorqueStr[i] = "outputTorque" .. tostring(i)
  outputAVStr[i] = "outputAV" .. tostring(i)
  outputTorqueStr[i] = "outputTorque" .. tostring(i)
  outputAVStr[i] = "outputAV" .. tostring(i)
end
        t.children = t.children or {}
        local dummyShaft = deviceFactories["shaft"].new(makeDummyShaft("dummyShaft" .. tostring(dummyShaftCounter), t.name, index))
        dummyShaftCounter = dummyShaftCounter + 1
    else
      log("E", "powertrain.init", "Can't load powertrain device factories, looking for directory: " .. tostring(globalDirectory))
    end
      device.parent = device.parent or {isFake = true, outputTorque0 = 0, outputTorque1 = 0, outputTorque2 = 0, deviceCategories = {}}
      device.parentOutputAVName = "outputAV" .. tostring(device.inputIndex)
      device.parentOutputTorqueName = "outputTorque" .. tostring(device.inputIndex)
      device.parentOutputAVName = "outputAV" .. tostring(device.inputIndex)
      device.parentOutputTorqueName = "outputTorque" .. tostring(device.inputIndex)
      device.visualShaftAVName = device.visualShaftAVName or "inputAV"
@/lua/ge/extensions/flowgraph/link.lua

  local label = '<' .. tostring(self.sourcePin.accessName or self.sourcePin.name) .. '>'
    im.Separator()
    im.Text("id: %s", tostring(self.id))
    im.Text("From: %s", tostring(self.sourcePin.id))
    im.Text("id: %s", tostring(self.id))
    im.Text("From: %s", tostring(self.sourcePin.id))
    im.Text("To: %s", tostring(self.targetPin.id))
    im.Text("From: %s", tostring(self.sourcePin.id))
    im.Text("To: %s", tostring(self.targetPin.id))
  end
@/lua/common/libs/lua-MessagePack/MessagePack.lua
local function argerror(caller, narg, extramsg)
  error("bad argument #" .. tostring(narg) .. " to "
      .. caller .. " (" .. extramsg .. ")")
  else
    packers['string'](tostring(udata))
  end
  local fixext = 0xD4 + k
  packers['fixext' .. tostring(n)] = function(tag, data)
    bufTmp:put(char(fixext, tag < 0 and tag + 0x100 or tag))
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/vehicleStoppedNearPlane.lua

  -- dump("isStopped: " .. tostring(isStopped))
  -- dump("isNearPlane: " .. tostring(isNearPlane) .. " signedDistance: " .. tostring(signedDistance))
  -- dump("isStopped: " .. tostring(isStopped))
  -- dump("isNearPlane: " .. tostring(isNearPlane) .. " signedDistance: " .. tostring(signedDistance))
  -- dump("isStopped: " .. tostring(isStopped))
  -- dump("isNearPlane: " .. tostring(isNearPlane) .. " signedDistance: " .. tostring(signedDistance))
@/lua/vehicle/mapmgr.lua

  obj:queueGameEngineLua("extensions.hook('onVehicleMapmgrUpdate', "..tostring(objectId)..")")
end
@/lua/ge/extensions/editor/flowgraph/nodePreview.lua
        if not status then
          log('E', 'node.'..tostring('drawGraph'), tostring(err))
          node._isSelected = true
        if not status then
          log('E', 'node.'..tostring('drawGraph'), tostring(err))
          node._isSelected = true
          node._isSelected = true
          node:__setNodeError('work', 'Error while executing node:_drawMiddle(): ' .. tostring(err))
        end
@/lua/ge/extensions/ui/apps/pointsBar.lua
  guiData.fillPercent = points / maxValue
  guiData.pointsLabel = pointsLabel or tostring(points)
  guiData.thresholdsReached = {}
@/lua/ge/extensions/flowgraph/modules/aiRecordingModule.lua
      -- schedule the recording to be stopped and be sent from the vehicle to this module
      veh:queueLuaCommand('obj:queueGameEngineLua("extensions.hook(\\"onVehicleSubmitRecordingForMission\\","..tostring(objectId)..","..serialize(ai.stopRecording())..")")')
    end
@/lua/ge/extensions/flowgraph/nodes/scene/spawnTSStatic.lua
  -- name will be generated to avoid duplicate names
  local name = "spawnedObj_" .. tostring(os.time()) .. "_" .. self.id..'_'.. #self.objects
  object:registerObject(name)
@/lua/ge/extensions/scenario/scenariosLoader.lua
    if #scenarioData.previews == 0 then
      log('W', logTag, 'scenario has no previews: ' .. tostring(scenarioData.scenarioName))
    end
  -- if #previews == 0 then
  --   log('W', 'scenarios', 'scenario has no previews: ' .. tostring(scenarioData.scenarioName))
  -- end
@/lua/common/jbeam/variables.lua
    if firstKey ~= enforcedFirstKey then
      log('E', 'component', 'path not starting with "' .. tostring(enforcedFirstKey) .. '" [' .. tostring(path) .. '] - rejecting.')
      return nil
    if firstKey ~= enforcedFirstKey then
      log('E', 'component', 'path not starting with "' .. tostring(enforcedFirstKey) .. '" [' .. tostring(path) .. '] - rejecting.')
      return nil
            d[key] = expressionParser.parseSafe(v, vars)
            --log('I', "jbeam.applyVariables", "set variable "..tostring(key).." to ".. tostring(d[key]))
          else
            d[key] = expressionParser.parseSafe(v, vars)
            --log('I', "jbeam.applyVariables", "set variable "..tostring(key).." to ".. tostring(d[key]))
          else
                if new_val == nil then
                  log('E', 'component', 'path not found: "' .. tostring(componentKey) .. '"')
                  d[key] = nil
                else
                  log('I', 'component', 'path processed: "' .. tostring(componentKey) .. '" = ' .. dumps(new_val))
                  d[key] = deepcopy(new_val)
                if vars[v] == nil then
                  log('E', "jbeam.applyVariables", "missing variable "..tostring(v))
                  d[key] = nil
                end
                --log('I', "jbeam.applyVariables", "set variable "..tostring(key).." to ".. tostring(data[key]))
              end
                end
                --log('I', "jbeam.applyVariables", "set variable "..tostring(key).." to ".. tostring(data[key]))
              end
      if valBeforeClamp ~= vv.val then
        log('W', 'variables', 'variable ' .. tostring(vv.name) .. ' value out of range! value ' .. tostring(valBeforeClamp) .. ' clamped to range [' .. tostring(vv.min) .. ',' .. tostring(vv.max) .. '] as ' .. tostring(vv.val))
      end
      if valBeforeClamp ~= vv.val then
        log('W', 'variables', 'variable ' .. tostring(vv.name) .. ' value out of range! value ' .. tostring(valBeforeClamp) .. ' clamped to range [' .. tostring(vv.min) .. ',' .. tostring(vv.max) .. '] as ' .. tostring(vv.val))
      end
      if valBeforeClamp ~= vv.val then
        log('W', 'variables', 'variable ' .. tostring(vv.name) .. ' value out of range! value ' .. tostring(valBeforeClamp) .. ' clamped to range [' .. tostring(vv.min) .. ',' .. tostring(vv.max) .. '] as ' .. tostring(vv.val))
      end
      if valBeforeClamp ~= vv.val then
        log('W', 'variables', 'variable ' .. tostring(vv.name) .. ' value out of range! value ' .. tostring(valBeforeClamp) .. ' clamped to range [' .. tostring(vv.min) .. ',' .. tostring(vv.max) .. '] as ' .. tostring(vv.val))
      end
      if valBeforeClamp ~= vv.val then
        log('W', 'variables', 'variable ' .. tostring(vv.name) .. ' value out of range! value ' .. tostring(valBeforeClamp) .. ' clamped to range [' .. tostring(vv.min) .. ',' .. tostring(vv.max) .. '] as ' .. tostring(vv.val))
      end
    else
      log('E', 'variables', 'variable ' .. tostring(vv.name) .. ' ignored, unknown type: ' .. tostring(vv.type))
    end
    else
      log('E', 'variables', 'variable ' .. tostring(vv.name) .. ' ignored, unknown type: ' .. tostring(vv.type))
    end
    else
      --log('W', 'variables', 'variable ignored for UI: ' .. tostring(k) .. ' = ' .. tostring(v))
      --newVars[k] = v
    else
      --log('W', 'variables', 'variable ignored for UI: ' .. tostring(k) .. ' = ' .. tostring(v))
      --newVars[k] = v
        if svars[k] == nil then
          log('E', "jbeam.applyVariables", "missing variable "..tostring(v))
        else
        end
        --log('I', "jbeam.applyVariables", "set variable "..tostring(key).." to ".. tostring(data[key]))
      end
        end
        --log('I', "jbeam.applyVariables", "set variable "..tostring(key).." to ".. tostring(data[key]))
      end
  local varStack = {}
  varStack[tostring(rootPart)] = deepcopy(vars)
    local slotVarCopy = deepcopy(slot.variables or {})
    local svars = applySlotVars(slotVarCopy, varStack[tostring(parentPart)] or {})
    svars = tableMerge(deepcopy(varStack[tostring(parentPart)]), svars)
    local svars = applySlotVars(slotVarCopy, varStack[tostring(parentPart)] or {})
    svars = tableMerge(deepcopy(varStack[tostring(parentPart)]), svars)
    svars['$components'] = {val = rootPart.components}

    varStack[tostring(part)] = svars
    --dump(varStack)
@/lua/ge/ge_utils.lua
scenetree.__index = function(class_table, memberName)
  --log('E', logTag,'scenetree.__index('..tostring(class_table) .. ', ' .. tostring(memberName)..')')
  --dump(class_table)
scenetree.__index = function(class_table, memberName)
  --log('E', logTag,'scenetree.__index('..tostring(class_table) .. ', ' .. tostring(memberName)..')')
  --dump(class_table)
  -- scenetree tests:
  log('D', logTag,"scenetree - test #1 = " .. tostring(scenetree.sunsky.shadowDistance))
  log('D', logTag,"scenetree - test #2 = " .. tostring(scenetree.sunsky:getDeclarationLine()))
  log('D', logTag,"scenetree - test #1 = " .. tostring(scenetree.sunsky.shadowDistance))
  log('D', logTag,"scenetree - test #2 = " .. tostring(scenetree.sunsky:getDeclarationLine()))
  log('D', logTag,"scenetree - test #3 = " .. tostring(scenetree['sunsky']:getDeclarationLine()))
  log('D', logTag,"scenetree - test #2 = " .. tostring(scenetree.sunsky:getDeclarationLine()))
  log('D', logTag,"scenetree - test #3 = " .. tostring(scenetree['sunsky']:getDeclarationLine()))
  log('D', logTag,"-getter tests")
  log('D', logTag,"shadowDistance - getter #1 = " .. tostring(obj.shadowDistance))
  log('D', logTag,"shadowDistance - getter #2 = " .. tostring(obj['shadowDistance']))
  log('D', logTag,"shadowDistance - getter #1 = " .. tostring(obj.shadowDistance))
  log('D', logTag,"shadowDistance - getter #2 = " .. tostring(obj['shadowDistance']))
  log('D', logTag,"shadowDistance - getter #3 = " .. tostring(obj:get('shadowDistance')))
  log('D', logTag,"shadowDistance - getter #2 = " .. tostring(obj['shadowDistance']))
  log('D', logTag,"shadowDistance - getter #3 = " .. tostring(obj:get('shadowDistance')))
  if obj.shadowDistanceNonExisting == nil then
  else
    log('D', logTag,"shadowDistanceNonExisting - getter #4 ERROR = " .. tostring(obj.shadowDistanceNonExisting))
  end
  log('D', logTag,"-usage tests")
  log('D', logTag,">> shadowDistance = " .. tostring(obj.shadowDistance))
  obj.shadowDistance = 123
  obj.shadowDistance = 123
  log('D', logTag,">> shadowDistance = " .. tostring(obj.shadowDistance))
  log('D', logTag,"-protected fields tests")
  log('D', logTag,">> canSave = " .. tostring(obj.canSave))
  log('D', logTag,">> canSave set to false")
  obj.canSave = false
  log('D', logTag,">> canSave = " .. tostring(obj.canSave))
  obj.canSave = true
function scenetree_test_fields()
  print('testing fields of "thePlayer": ' .. tostring(scenetree.thePlayer))
  local player = scenetree.thePlayer
      if val == nil then
        print(' N ' .. tostring(k) .. ' = NIL [' .. (f.type or 'unknown') .. ']')
      else
      else
        print(' * ' .. tostring(k) .. ' = ' .. tostring(player[k]) .. ' [Types| Lua: ' .. type(val) .. ', C: ' .. (f.type or 'unknown') .. ']')
      end
      else
        print(' * ' .. tostring(k) .. ' = ' .. tostring(player[k]) .. ' [Types| Lua: ' .. type(val) .. ', C: ' .. (f.type or 'unknown') .. ']')
      end
    else
      print(' x UNSUPPORTED TYPE: ' .. tostring(k) .. ' [' .. (f.type or 'unknown') .. ']')
    else
      argsStr = argsStr .. tostring(v)
    end
    else
      argsStr = argsStr .. tostring(v)
    end
  end
  setConsoleVariable( name, tostring(value) )
end
  if _G[className] == nil then
    log('E', 'scenetree', 'Unable to create object: unknown class: ' .. tostring(className))
    return nil

  -- print('Creation object of class ' .. tostring(className) .. ' resulted in type ' .. tostring(getmetatable(obj).___type))

  -- print('Creation object of class ' .. tostring(className) .. ' resulted in type ' .. tostring(getmetatable(obj).___type))
  else
    log('E', "vehicleSetPositionRotation", 'vehicle not found: ' .. tostring(id))
  end
  local model = obj and obj.jbeam or 'pessima' -- if vehId or vehicle is nil, uses this vehicle paint data as a fallback
  local config = obj and tostring(obj.partConfig)
  if not obj then
    if not vehicle then
      log('W',logTag, 'there is no vehicle with id: '..tostring(vid))
      return
    if not vehicle:isSubClassOf('BeamNGVehicle') then
      log('W',logTag, 'Invalid vehicle id detected. id: '..tostring(vid))
      return
  end
  name = objectName..tostring(maxId + 1)
  return name
      file:close()
      --print(">>>>> load <<<< " .. tostring(modulename) .. ' = ' .. tostring(filename))
      if string.find(filename, '/extensions/') then
      file:close()
      --print(">>>>> load <<<< " .. tostring(modulename) .. ' = ' .. tostring(filename))
      if string.find(filename, '/extensions/') then
      v = math.floor(res[k] / 1024 / 1024)
      if v > 0 then log('I', 'GFX memory profiler:', k .. " = " .. tostring(v).. " MB" ) end
    end
@/lua/ge/extensions/flowgraph/baseStateNode.lua
  for k, v in pairs(C) do
    --print('k = ' .. tostring(k) .. ' = '.. tostring(v) )
    o[k] = v
  for k, v in pairs(C) do
    --print('k = ' .. tostring(k) .. ' = '.. tostring(v) )
    o[k] = v
  for k, v in pairs(derivedClass) do
    --print('k = ' .. tostring(k) .. ' = '.. tostring(v) )
    o[k] = v
  for k, v in pairs(derivedClass) do
    --print('k = ' .. tostring(k) .. ' = '.. tostring(v) )
    o[k] = v
@/lua/ge/extensions/editor/sceneTree.lua
    elseif searchNodeMode == SearchMode_ID then
      if imgui.ImGuiTextFilter_PassFilter(instance.nameFilter, tostring(node.id)) then
        node.filterResult = searchMatches[3]
    elseif searchNodeMode == SearchMode_PersistentID then
      if imgui.ImGuiTextFilter_PassFilter(instance.nameFilter, tostring(node.persistentId)) then
        node.filterResult = searchMatches[4]
      end
      if imgui.ImGuiTextFilter_PassFilter(instance.nameFilter, tostring(node.id)) then
        node.filterResult = node.filterResult + searchMatches[3]
      end
      if imgui.ImGuiTextFilter_PassFilter(instance.nameFilter, tostring(node.persistentId)) then
        node.filterResult = node.filterResult + searchMatches[4]
    end
    -- log('I','','Op = '..opTypeToString[op.type + 1]..' objId = '..tostring(op.objId)..' groupId = '..op.groupId)
    currentBatchOp = op.type
    end
    objectHistoryActions.changeObjectFieldWithUndo(objectIDs, field, tostring(newValue), 0)
    editor.setDirty()
          local highestObj = editor.getHighestObject(objects)
          log('I','','     highest object: '..tostring(highestObj:getName()))
          local parentGroup = highestObj:getGroup()
          if parentGroup then
            log('I','','     parent group: '..tostring(parentGroup:getName()))
          end
          local highestObj = editor.getHighestObject(objects)
          log('I','','     highest object: '..tostring(highestObj:getName()))
          local parentGroup = highestObj:getGroup()
          if parentGroup then
            log('I','','     parent group: '..tostring(parentGroup:getName()))
          end
    if bit.band(node.filterResult, searchMatches[3]) ~= 0 then
      nodeLabel = nodeLabel .. ' [id: ' .. tostring(node.id) .. ']'
    end
    if bit.band(node.filterResult, searchMatches[3]) ~= 0 then
      nodeLabel = nodeLabel .. ' [id: ' .. tostring(node.id) .. ']'
    end
    if bit.band(node.filterResult, searchMatches[3]) ~= 0 then
      nodeLabel = nodeLabel .. ' [id: ' .. tostring(node.id) .. ']'
    end
        --imgui.Dummy(imgui.ImVec2(5, imgui.GetStyle().ItemSpacing.y))
        local label = tostring(#searchResults) .. ' matches'
        if searchRange > 0 then
      else
        return guiInstancer.instances[tostring(guiInstancer.nextInstanceIndex - 1)].selectedNodes
      end
      if node then
        log('I','',tostring(id)..' node = '..dumpsz(node, level))
      end
@/lua/ge/extensions/gameplay/rally/tools/loopToolbox.lua
  im.TextColored(colorYellow, "Mission Info")
  im.Text("  Mission ID: " .. tostring(manager.missionId or "N/A"))
  im.Text("  Mission Dir: " .. tostring(manager.missionDir or "N/A"))
  im.Text("  Mission ID: " .. tostring(manager.missionId or "N/A"))
  im.Text("  Mission Dir: " .. tostring(manager.missionDir or "N/A"))
    local statusColor = proximityData.isNear and colorGreen or colorRed
    im.TextColored(statusColor, string.format("Near: %s | Dist: %.2fm | Frozen: %s", tostring(proximityData.isNear), proximityData.distance or 0, tostring(proximityData.isFrozen or false)))
    local progress = (proximityData.timer or 0) / math.max(1e-12, proximityData.duration or 1)
    local statusColor = proximityData.isNear and colorGreen or colorRed
    im.TextColored(statusColor, string.format("Near: %s | Dist: %.2fm | Frozen: %s", tostring(proximityData.isNear), proximityData.distance or 0, tostring(proximityData.isFrozen or false)))
    local progress = (proximityData.timer or 0) / math.max(1e-12, proximityData.duration or 1)

  im.Text("  Current Index: " .. tostring(manager.currentMissionIndex) .. " / " .. tostring(#manager.missionSequence))
  if not missionsMatch then

  im.Text("  Current Index: " .. tostring(manager.currentMissionIndex) .. " / " .. tostring(#manager.missionSequence))
  if not missionsMatch then
  -- im.SameLine()
  -- im.Text("Found: " .. tostring(#self.signboards))
    if not success then
      log('W', logTag, 'Failed to draw signboard with ID ' .. tostring(signboard.id))
    end
@/lua/ge/extensions/editor/multiSpawnManager.lua
      for i, v in ipairs(options.generatedGroup) do
        im.TextUnformatted(tostring(i))
        im.NextColumn()
        im.NextColumn()
        im.TextUnformatted(tostring(v.configPop))
        im.NextColumn()

    im.TextUnformatted("Vehicle #"..tostring(options.vehIdx))
    im.NextColumn()
@/lua/ge/extensions/editor/assemblySpline/molecule.lua
      if not isPlaced[i] then
        log('W', logtag, 'Invalid molecule: unplaced rigid mesh: ' .. tostring(rigids[i].mesh.fileName))
      end
    if #attachments ~= 2 then
      log('W', logtag, 'Bridge must have exactly 2 attachment points: ' .. tostring(bridgeMesh.mesh.fileName))
      return nil -- Bridges must have exactly 2 attachment points (source and target).
    if not isSourceFound or not isTargetFound then
      log('W', logtag, 'Bridge could not attach to molecule: ' .. tostring(bridgeMesh.mesh.fileName))
      return nil -- We cannot have free bridges. They must span across molecules.
@/lua/ge/extensions/editor/roadDecorations.lua

    local groupName = string.format('decorations.%d', tostring(roadName))
    local group = scenetree.findObject(groupName)
@/lua/ge/extensions/editor/scriptAIEditor.lua
            if alreadyAttachedVehicles[vid] == nil and tr.jBeam == veh.JBeam then
              tr.vehicle = tostring(vid .. ": " .. veh:getName() .. " - " .. veh.JBeam)
              tr.vid = vid
      local importedData = jsonReadFile(data.filepath)
      local tIdx = "imported_" .. tostring(getNextUniqueId())
      local isTimeBased = true
            local p = vec3(n.x[0], n.y[0], n.z[0])
            debugDrawer:drawTextAdvanced(p, tostring(j), colors.textA, true, false, colors.textB)
          end
                  local velKph = (d * 3.6) / (n2.t[0] - n1.t[0])
                  debugDrawer:drawTextAdvanced(mid, tostring(round1(velKph)) .. ' kph', colors.textA, true, false, colors.textB)
                end
                  local p = vec3(n.x[0], n.y[0], n.z[0])
                  debugDrawer:drawTextAdvanced(p, tostring(round1(n.v[0] * 3.6)) .. ' kph', colors.textA, true, false, colors.textB)
                end
      end
      debugDrawer:drawTextAdvanced(p, tostring(j), colors.textA, true, false, colors.textB)
    end
      config = config,
      string = tostring(vid .. ": " .. vehName .. " - " .. jBeam) }
    if vehWinData.isRecording[ctr] == nil then
        if tr.vehicle ~= nil and tr.vehicle == vehicle.string then
          vehicleAttachState = "Attached Trajectory: [" .. tostring(k) .. "]"
          break
              if vwd.recordMode[i] == nil then vwd.recordMode[i] = im.IntPtr(1) end
              if im.RadioButton2("T-Based###" .. tostring(ctr), vwd.recordMode[i], im.Int(1)) then end
              im.SameLine()
              im.SameLine()
              if im.RadioButton2("V-Based###" .. tostring(ctr + 1), vwd.recordMode[i], im.Int(2)) then end
              ctr = ctr + 2
              if editor.uiIconImageButton(editor.icons.stop, im.ImVec2(21, 21), nil, nil, nil, 'stopRecordingScript') then
                scenetree.findObject(veh.vid):queueLuaCommand('obj:queueGameEngineLua("extensions.hook(\\"onVehicleSubmitRecording\\","..tostring(objectId)..","..serialize(ai.stopRecording())..")")')
                stopExecute()
          if k == tlwd.selectedTraj then flag = true end
          if im.Selectable1(tostring(k), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            tlwd.selectedTraj = k
        -- Display the window.
        if editor.beginWindow(windowName, "Trajectory - " .. tostring(tIdx)) then
          -- The trajectory color bar.
            im.Text("Mode: [Time-Based]")
            im.Text('Interval: [' .. tostring(round2(polyLine[1].t[0])) .. ', ' .. tostring(round2(polyLine[#polyLine].t[0])) .. ']')
          else
            im.Text("Mode: [Time-Based]")
            im.Text('Interval: [' .. tostring(round2(polyLine[1].t[0])) .. ', ' .. tostring(round2(polyLine[#polyLine].t[0])) .. ']')
          else
          local tOld = n.t[0]
          if im.InputFloat("Time##" .. tostring(ctr), n.t, 0.1, 1.0) then
            isChange = true
          im.NextColumn()
          if im.InputFloat("Smoothness##" .. tostring(ctr + 1), n.smoothness, 0.1, 0.1) then
            isChange = true
          im.NextColumn()
          im.Checkbox("Moving Start##" .. tostring(ctr + 2), n.movingStart)
          im.tooltip('Set whether or not to allow continuous movement on approach to this node.')
          im.NextColumn()
          im.Checkbox("Moving End##" .. tostring(ctr + 3), n.movingEnd)
          im.tooltip('Set whether or not to allow continuous movement on departure from this node.')
        if editor.uiIconImageButton(editor.icons.check, im.ImVec2(26, 26), nil, nil, nil, 'finishDrawInTrajectory') then
          local tIdx = "drawn_" .. tostring(getNextUniqueId())
          local isTimeBased = true
  end
  local tIdx = "recorded_" .. tostring(getNextUniqueId())
  local isTimeBased = true
      jBeam = veh.JBeam
      vString= tostring(vid .. ": " .. vehName .. " - " .. jBeam)
    end
@/lua/ge/extensions/gameplay/race/race.lua
  if not json then
    log('E', 'race', 'unable to find race file: ' .. tostring(file))
    return
@/lua/ge/extensions/freeroam/vueBigMap.lua
  else
    log("E", "", "Action function not found for ID: " .. tostring(actionId))
    return "error"
@/lua/ge/extensions/trackbuilder/trackBuilder.lua
      if (doFill or holdAndPaint or pipette) and res.object then
        local txt = '[' .. tostring(res.object:getId()) .. ']'
        --dump(txt)
@/lua/ge/extensions/editor/biomeTool.lua
    layerID = layerIndex,
    layerName = prefix.." ".."Layer "..tostring(layerIndex),
    lassoAreas = {}
    else
      editor.logWarn("Missing forest brush element ID: " .. tostring(id))
    end
  local panelWidth = imgui.GetContentRegionAvail().x
  imgui.BeginChild1("LayerMainPanel##"..tostring(layer.layerType)..tostring(layer.layerID), imgui.ImVec2(imgui.GetContentRegionAvail().x, imgui.GetContentRegionAvail().y), nil)
  local panelWidth = imgui.GetContentRegionAvail().x
  imgui.BeginChild1("LayerMainPanel##"..tostring(layer.layerType)..tostring(layer.layerID), imgui.ImVec2(imgui.GetContentRegionAvail().x, imgui.GetContentRegionAvail().y), nil)
        local blendingMethod = getBlendingMethod(layerType, layerID)
        local fileSuffix = tostring(layerType).."_"..tostring(layerID)
        local edgeElements = getForestBrushElementsFromSelection(layerType, layerID, enum_forestBrushItemZone.edge)
        local blendingMethod = getBlendingMethod(layerType, layerID)
        local fileSuffix = tostring(layerType).."_"..tostring(layerID)
        local edgeElements = getForestBrushElementsFromSelection(layerType, layerID, enum_forestBrushItemZone.edge)
        imgui.BeginDisabled()
        editor.uiInputText("##inputTextDensity##"..layer.layerType..layer.layerID, editor.getTempCharPtr(tostring(getLassoAreaCount(layer.layerType, layer.layerID))))
        imgui.EndDisabled()
    local positionSliderEditEnded = imgui.BoolPtr(false)
    if editor.uiDragFloat2("##" .."SlopeRange"..tostring(customData.areaID)..tostring(customData.layerID),
      range, 0.2, 0, 90, "%0." .. editor.getPreference("ui.general.floatDigitCount") .. "f", 1, positionSliderEditEnded) then
    local positionSliderEditEnded = imgui.BoolPtr(false)
    if editor.uiDragFloat2("##" .."SlopeRange"..tostring(customData.areaID)..tostring(customData.layerID),
      range, 0.2, 0, 90, "%0." .. editor.getPreference("ui.general.floatDigitCount") .. "f", 1, positionSliderEditEnded) then
@/lua/ge/extensions/util/calibrateESC.lua
  local configCount = tableSize(filteredConfigs)
  log("I", logTag, tostring(configCount) .. " configs")
    local config = v.key
    log("I", logTag, tostring(progressCount) .. " / " .. tostring(configCount) .. ": " .. tostring(vehName) .. "->" .. tostring(config))
    local filepath = "vehicles/" .. vehName .. "/info_" .. config .. ".touched"
    local config = v.key
    log("I", logTag, tostring(progressCount) .. " / " .. tostring(configCount) .. ": " .. tostring(vehName) .. "->" .. tostring(config))
    local filepath = "vehicles/" .. vehName .. "/info_" .. config .. ".touched"
    local config = v.key
    log("I", logTag, tostring(progressCount) .. " / " .. tostring(configCount) .. ": " .. tostring(vehName) .. "->" .. tostring(config))
    local filepath = "vehicles/" .. vehName .. "/info_" .. config .. ".touched"
    local config = v.key
    log("I", logTag, tostring(progressCount) .. " / " .. tostring(configCount) .. ": " .. tostring(vehName) .. "->" .. tostring(config))
    local filepath = "vehicles/" .. vehName .. "/info_" .. config .. ".touched"
@/lua/ge/extensions/core/vehicle/inplaceEdit.lua
  if not part then
    log('E', '', 'part not found: ' .. tostring(partName))
    return
    --else
    --  log('E', '', 'slot empty? ' .. tostring(slot.type))
    end
  if not chosenPartName or chosenPartName == '' or chosenPartName == 'nil' then
    --log('E', '', 'part not found: ' .. tostring(chosenPartName))
    return
  if not part then
    log('E', '', 'part not found: ' .. tostring(partName))
    return
  text("****************************************************************************************************************")
  text(" " .. tostring(tableSize(vBundle.vdata.activePartsData)) .. " active parts")
  text(" " .. tostring(tableSize(availableParts)) .. " available parts")
  text(" " .. tostring(tableSize(vBundle.vdata.activePartsData)) .. " active parts")
  text(" " .. tostring(tableSize(availableParts)) .. " available parts")
  if selectedPartName then
      end
      txt = txt .. slot.type .. ' = ' .. tostring(chosenPartName)
      text(txt)
          selectPart(chosenPartName)
          dump{'parent part: ', tostring(parentPartName), 'new part: ', chosenPartName}
        end
        selectPart(oldPartName)
        --dump{'parent part: ', tostring(parentPartName), 'new part: ', oldPartName}
      end
@/lua/ge/extensions/editor/gen/world.lua
local function reload(mode)
	lo('>> world.reload:'..#apack..':'..tostring(scope))
		D = rerequire(apack[3])
		lo('??+++++++++++++++++++++++++++++++++++ FOR_D:'..tostring(D)..':'..tostring(D.junctionUp))
		W.ui.exit_w = D.out.default.wexit
		D = rerequire(apack[3])
		lo('??+++++++++++++++++++++++++++++++++++ FOR_D:'..tostring(D)..':'..tostring(D.junctionUp))
		W.ui.exit_w = D.out.default.wexit
	local terrBlock = TerrainBlock()
		lo('>> terrainUp:'..path..':'..tostring(terrBlock))

		lo('?? ifTB2:'..tostring(scenetree.findClassObjects("TerrainBlock")))
	local terrainBlockProxies = {}
	for _, name in ipairs(scenetree.findClassObjects("TerrainBlock")) do
			lo('?? ifTB:'.._..':'..name) --tostring(scenetree.findClassObjects("TerrainBlock")))
		terrainBlockProxies[name] = {selected = false, id = scenetree.findObject(name):getID()}
			terrBlock = scenetree.findObjectById(tbData.id)
			lo('?? forTB:'..tostring(terrBlock))
		  end

		lo('?? impsucc:'..tostring(success))
	if data == nil or #data == 0 or not M.valid(data) then
		lo('!! meshUp_NODATA:') --..tostring(M.valid(data)))
		return
	om.canSave = false
	om:registerObject('tmp_'..tostring(os.clock()))
	local id = om:getID()
local function daeImport(path, cls)
	lo('>> daeImport:'..path) --..':'..('dir '..path..[[ /b]])..':'..tostring(io.popen('echo "AAA"')))
		list = {}, w = nil, h = nil}
	lo('?? if_FO:'..tostring(scenetree.findObject('ForestItemData')))
end
	end
	lo('>> daeLoad_:'..tp..':'..pth..':'..#afile..' mute:'..tostring(mute))
local function forTerrain()
	lo('>>********************** forTerrain:'..tostring(#editor_roadUtils.getMaterialNames())..':'..tostring(scope)..':'..tostring(_mode))
local function forTerrain()
	lo('>>********************** forTerrain:'..tostring(#editor_roadUtils.getMaterialNames())..':'..tostring(scope)..':'..tostring(_mode))
local function forTerrain()
	lo('>>********************** forTerrain:'..tostring(#editor_roadUtils.getMaterialNames())..':'..tostring(scope)..':'..tostring(_mode))

	U.dump(aref, '?? for_ext:'..tostring(ext)..':'..L..':'..tableSize(aref))
--++
		if not (ij[2] and ij[1] and desc.afloor[ij[1]]) then
			lo('!! ERR_base2world_NO:'..tostring(ij[1])..':'..tostring(ij[2])..':'..tostring(#desc.afloor))
		end
		if not (ij[2] and ij[1] and desc.afloor[ij[1]]) then
			lo('!! ERR_base2world_NO:'..tostring(ij[1])..':'..tostring(ij[2])..':'..tostring(#desc.afloor))
		end
		if not (ij[2] and ij[1] and desc.afloor[ij[1]]) then
			lo('!! ERR_base2world_NO:'..tostring(ij[1])..':'..tostring(ij[2])..':'..tostring(#desc.afloor))
		end
		if dbg then
			U.dump(ij, '?? forBuilding2:'..tostring(desc))
		end
			if dbg then
				lo('?? FB:'..tostring(aij)..':'..tostring(scope)..':'..tostring(ij and ij[2] or nil)..':'..i..':'..tostring(cfloor),true)
			end
			if dbg then
				lo('?? FB:'..tostring(aij)..':'..tostring(scope)..':'..tostring(ij and ij[2] or nil)..':'..i..':'..tostring(cfloor),true)
			end
			if dbg then
				lo('?? FB:'..tostring(aij)..':'..tostring(scope)..':'..tostring(ij and ij[2] or nil)..':'..i..':'..tostring(cfloor),true)
			end
			if dbg then
				lo('?? FB:'..tostring(aij)..':'..tostring(scope)..':'..tostring(ij and ij[2] or nil)..':'..i..':'..tostring(cfloor),true)
			end
			if dbg then
				lo('?? FB2:'..tostring(tocall)..':'..tostring(scope)..':'..tostring(ij and ij[2] or nil)..':'..i..':'..tostring(cfloor),true)
			end
			if dbg then
				lo('?? FB2:'..tostring(tocall)..':'..tostring(scope)..':'..tostring(ij and ij[2] or nil)..':'..i..':'..tostring(cfloor),true)
			end
			if dbg then
				lo('?? FB2:'..tostring(tocall)..':'..tostring(scope)..':'..tostring(ij and ij[2] or nil)..':'..i..':'..tostring(cfloor),true)
			end
			if dbg then
				lo('?? FB2:'..tostring(tocall)..':'..tostring(scope)..':'..tostring(ij and ij[2] or nil)..':'..i..':'..tostring(cfloor),true)
			end
W.daeExport = function()
	lo('>> daeExport:'..tostring(cedit.mesh)..':'..tableSize(adesc))
	local mat
	editor.selectObjects(aid, editor.SelectMode_Add)
	lo('?? daeExport:'..#aid..':'..#afi..':'..tostring(tableSize(editor.selection))) --..':'..tostring(editor.selection.forestItem))--..':'..tostring(aid[1])..':'..tostring(editor.selection.object.id)..':'..tostring(tableSize(editor.selection)))
	editor.selectObjects(aid, editor.SelectMode_Add)
	lo('?? daeExport:'..#aid..':'..#afi..':'..tostring(tableSize(editor.selection))) --..':'..tostring(editor.selection.forestItem))--..':'..tostring(aid[1])..':'..tostring(editor.selection.object.id)..':'..tostring(tableSize(editor.selection)))
	editor.selectObjects(aid, editor.SelectMode_Add)
	lo('?? daeExport:'..#aid..':'..#afi..':'..tostring(tableSize(editor.selection))) --..':'..tostring(editor.selection.forestItem))--..':'..tostring(aid[1])..':'..tostring(editor.selection.object.id)..':'..tostring(tableSize(editor.selection)))
	editor.selectObjects(aid, editor.SelectMode_Add)
	lo('?? daeExport:'..#aid..':'..#afi..':'..tostring(tableSize(editor.selection))) --..':'..tostring(editor.selection.forestItem))--..':'..tostring(aid[1])..':'..tostring(editor.selection.object.id)..':'..tostring(tableSize(editor.selection)))
	editor.selectObjects(aid, editor.SelectMode_Add)
	lo('?? daeExport:'..#aid..':'..#afi..':'..tostring(tableSize(editor.selection))) --..':'..tostring(editor.selection.forestItem))--..':'..tostring(aid[1])..':'..tostring(editor.selection.object.id)..':'..tostring(tableSize(editor.selection)))
			worldEditorCppApi.colladaExportSelection(data.filepath)
			lo('?? editor_fileDialog:'..tostring(data.filepath))
			M.matReplace(data.filepath) --,'mat_dummy')
			for i,key in ipairs(list) do
				if dbg then lo('?? fC_key:'..key..':'..tostring(dforest[key].item)) end
				if key == cedit.forest then
W.onQuit = function(forestoff)
	lo('>>^^^^^^^^^^^^^^^^^^^^ onQuit:'..tostring(cedit.mesh)..':'..tostring(adesc and #adesc or nil))
	if cedit.mesh then
W.onQuit = function(forestoff)
	lo('>>^^^^^^^^^^^^^^^^^^^^ onQuit:'..tostring(cedit.mesh)..':'..tostring(adesc and #adesc or nil))
	if cedit.mesh then
	local oedit = scenetree.findObject('edit')
	lo('?? onQuit:'..tostring(cedit.mesh)..':'..#scenetree.getAllObjects()..' edit:'..tostring(oedit))
	if oedit and groupEdit then
	local oedit = scenetree.findObject('edit')
	lo('?? onQuit:'..tostring(cedit.mesh)..':'..#scenetree.getAllObjects()..' edit:'..tostring(oedit))
	if oedit and groupEdit then
W.recover = function(jdesc, cb, keep)
    lo('>> recover:'..tostring(keep)..':'..tableSize(adesc))
	if not keep then
	for id,d in pairs(jdesc) do
		lo('?? for_desc:'..id..':'..tostring(adesc[tonumber(id)]))
		local cid = tonumber(id)
	-- remove current
	lo('>> fromJSON:'..tostring(fname)..':'..tostring(desc)..' asave:'..#asave)
	local function clean()
	-- remove current
	lo('>> fromJSON:'..tostring(fname)..':'..tostring(desc)..' asave:'..#asave)
	local function clean()
		desc = jsonReadFile(fname)
		lo('?? fromJSON2:'..fname..':'..tostring(desc))
		desc = U.fromJSON(desc)
		table.remove(asave, 1)
		lo('??=================== rollback:'..#asave..':'..tostring(desc),true)
	end
	end
	lo('?? if_corner:'..tostring(desc.acorner_))
	W.out.cdesc = desc
	end
	lo('<< fromJSON:'..tostring(desc.id)..':'..tostring(cedit.mesh)..':'..tostring(inrollback))
	end
	lo('<< fromJSON:'..tostring(desc.id)..':'..tostring(cedit.mesh)..':'..tostring(inrollback))
	end
	lo('<< fromJSON:'..tostring(desc.id)..':'..tostring(cedit.mesh)..':'..tostring(inrollback))
W.toLevel = function(desc, pth)
	lo('>>^^^^^^^^^^^^^^^^^^ toLevel:'..desc.id..':'..tostring(desc.idpersist))
	-- shape
	local fdir = U.path2disk({editor.getLevelPath(), 'forest'})
	lo('?? for_parts:'..tableSize(apart)..':'..tostring(fdir))
	local fname = fdir..nm..'.forest4.json'
	jdata = jdata:gsub('},{', '}\r\n{')
	lo('?? for_file:'..fname) --..':'..tostring(#data)..':'..#v..':'..jdata)
	fout:write(string.sub(jdata, 2, #jdata-1))
		d = W.houseUp(adesc[d.id], d.id)
		lo('?? hS:'..tostring(#d.data))
	end
	end
	lo('??********************************* hS.for_mat:'..nm..':'..d.afloor[1].awall[1].mat..':'..tostring(d.data[1].material)) --.top.shape..':'..#d.data)
--	M.toDAE(d.data, batdir..nm..'.dae')
	local idstat = obj:getID()
	lo('?? forJSON:'..tostring(obj.shapeName)..' STAT:'..idstat..':'..tostring(cedit.mesh))
	local nm = obj.name
	local idstat = obj:getID()
	lo('?? forJSON:'..tostring(obj.shapeName)..' STAT:'..idstat..':'..tostring(cedit.mesh))
	local nm = obj.name
	end
		lo('?? forJSON_nm:'..tostring(nm)..':'..tostring(cedit.mesh))
	if cedit.mesh then
	end
		lo('?? forJSON_nm:'..tostring(nm)..':'..tostring(cedit.mesh))
	if cedit.mesh then
		local om = scenetree.findObjectById(adesc[cedit.mesh].idstatic)
		lo('?? proc2stat:'..cedit.mesh..':'..tostring(nm)..':'..tostring(adesc[cedit.mesh].idstatic))
		if om then
		local om = scenetree.findObjectById(adesc[cedit.mesh].idstatic)
		lo('?? proc2stat:'..cedit.mesh..':'..tostring(nm)..':'..tostring(adesc[cedit.mesh].idstatic))
		if om then
	desc.idstatic =  idstat
	lo('??_________________ fromStatic:'..tostring(id)..':'..desc.idstatic..'/'..desc.idpersist)
	W.markUp()
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
local function up(d, inreload, inact, mode)
	lo('>>++++++++++ W.up:'..tostring(inreload)..':'..tostring(mode)..':'..tostring(forestName)) --..tostring(#core_forest.getForestObject():getData():getItems())) --..forestName..':'..tostring(inreload)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(restored)..':'..tostring(inact)..':'..tostring(forest)..' edit:'..tostring(scenetree.findObject('edit'))..':'..tostring(groupEdit)..':'..tostring(D))
	if not inact or not forest then
			-- the moment of loading forest items from level
			lo('??+++++++ forest_up:'..tostring(forestName)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(scenetree.findObject('theForest')),true)
			forest = scenetree.findObject('theForest')
			-- the moment of loading forest items from level
			lo('??+++++++ forest_up:'..tostring(forestName)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(scenetree.findObject('theForest')),true)
			forest = scenetree.findObject('theForest')
			-- the moment of loading forest items from level
			lo('??+++++++ forest_up:'..tostring(forestName)..':'..tostring(scenetree.findObject(forestName))..':'..tostring(scenetree.findObject('theForest')),true)
			forest = scenetree.findObject('theForest')
		local cancs = editor.getPreference("roadEditor.general.aiRoadsSelectable")
		lo('?? is_CC:'..tostring(cancs))
		if not cancs then
			local ok = U.path2disk({editor.getLevelPath(), 'art', 'forest'})
				lo('?? for_path:'..tostring(ok))
			for _,tp in pairs({'balcony','corner','doors','pillar','store_front','stairs',

	lo('?? up.if_rec:'..tostring(inrecover)..':'..tableSize(adesc))
	if inrecover then
	end
		lo('?? if_TEST:'..tostring(T)..':'..tostring(T.test_BAT)) --??
	if U._PRD == 0 then
	end
		lo('?? if_TEST:'..tostring(T)..':'..tostring(T.test_BAT)) --??
	if U._PRD == 0 then

	lo('<< W.up:'..tostring(mode))--..':'..#out.dyell)
end
	end
	lo('<< W.clear:'..tostring(fdata)) --..':'..#editor.getAllRoads())--..':'..out.ccommand)
end
	local H = forHeight(desc.afloor, ifloor-1)
	lo('>> splineUp:'..tostring(inupdate)..':'..key..':'..ifloor..':'..tostring(H)..':'..tostring(sdata)..':'..tostring(scope))
	local aw = U.split(key, '_')
	local H = forHeight(desc.afloor, ifloor-1)
	lo('>> splineUp:'..tostring(inupdate)..':'..key..':'..ifloor..':'..tostring(H)..':'..tostring(sdata)..':'..tostring(scope))
	local aw = U.split(key, '_')
	local H = forHeight(desc.afloor, ifloor-1)
	lo('>> splineUp:'..tostring(inupdate)..':'..key..':'..ifloor..':'..tostring(H)..':'..tostring(sdata)..':'..tostring(scope))
	local aw = U.split(key, '_')
	local H = forHeight(desc.afloor, ifloor-1)
	lo('>> splineUp:'..tostring(inupdate)..':'..key..':'..ifloor..':'..tostring(H)..':'..tostring(sdata)..':'..tostring(scope))
	local aw = U.split(key, '_')
				local winw = ddae[wall.win].w
				lo('?? sU_ws:'..tostring(wall.winspace)..':'..winw)
				sdata.def['win'] = {dae=wall.win, padding=wall.winspace-winw} --0.5}
		local padding = sdata.def['win'].padding
			lo('?? sU_padding:'..tostring(padding)..':'..#aforest)
		local winspace,doorspace = win.w + padding,door and door.w + 0.5 or 0
			if desc.df[desc.win].fitx then
				lo('??------ for_SPAN:'..desc.df[desc.win].fitx..':'..tostring(desc.winleft)..':'..tostring(scale), true)
				local newW = desc.u:length() - 2*desc.winleft
			if desc.df[desc.win].fitx then
				lo('??------ for_SPAN:'..desc.df[desc.win].fitx..':'..tostring(desc.winleft)..':'..tostring(scale), true)
				local newW = desc.u:length() - 2*desc.winleft
				end
--					lo('??************ if_PLN:'..tostring(aplinth))
				if aplinth then
--				pos.z = desc.pos.z
				U.dump(desc.pilaster, '??____*****^^^^^^^^^^^^^^^ for_PILA:'..desc.ij[1]..':'..desc.ij[2]..':'..desc.pilaster.span..' h:'..hfr..'>'..hto..' pos:'..pos.z..':'..tostring(cedit.forestkey))
				local ckey = to(desc, desc.pilaster.dae,
				end
					lo('??^^^^^^^^^^^___________________ if_KEYS:'..tostring(cedit.forest)..':'..tostring(ckey)..':'..tostring(cedit.foresttype))
				if ckey and cedit.foresttype == 'pilaster' then
				end
					lo('??^^^^^^^^^^^___________________ if_KEYS:'..tostring(cedit.forest)..':'..tostring(ckey)..':'..tostring(cedit.foresttype))
				if ckey and cedit.foresttype == 'pilaster' then
				end
					lo('??^^^^^^^^^^^___________________ if_KEYS:'..tostring(cedit.forest)..':'..tostring(ckey)..':'..tostring(cedit.foresttype))
				if ckey and cedit.foresttype == 'pilaster' then
				if ckey and cedit.foresttype == 'pilaster' then
--						lo('??>>>>> toCEF_SC:'..tostring(cedit.forest)..':'..tostring(cforest)..':'..tostring(dforest[cedit.forest])..':'..tostring(cedit.foresttype))
					cedit.forest = ckey
				if ckey and cedit.foresttype == 'pilaster' then
--						lo('??>>>>> toCEF_SC:'..tostring(cedit.forest)..':'..tostring(cforest)..':'..tostring(dforest[cedit.forest])..':'..tostring(cedit.foresttype))
					cedit.forest = ckey
				if ckey and cedit.foresttype == 'pilaster' then
--						lo('??>>>>> toCEF_SC:'..tostring(cedit.forest)..':'..tostring(cforest)..':'..tostring(dforest[cedit.forest])..':'..tostring(cedit.foresttype))
					cedit.forest = ckey
				if ckey and cedit.foresttype == 'pilaster' then
--						lo('??>>>>> toCEF_SC:'..tostring(cedit.forest)..':'..tostring(cforest)..':'..tostring(dforest[cedit.forest])..':'..tostring(cedit.foresttype))
					cedit.forest = ckey
					+ ((desc.u:length() - 2*(desc.pillar.margin + dpos.x)) % desc.pillar.space)/2
				lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mLeft:'..marginLeft..' marg:'..tostring(desc.pillar.margin)..' space:'..desc.pillar.space..' u:'..desc.u:length()..' dx:'..tostring(dpos)..':'..tostring(desc.pos)..' span:'..tostring(desc.pillar.span))
				local npillar = math.floor((desc.u:length() - 2*marginLeft)/desc.pillar.space)+1
					+ ((desc.u:length() - 2*(desc.pillar.margin + dpos.x)) % desc.pillar.space)/2
				lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mLeft:'..marginLeft..' marg:'..tostring(desc.pillar.margin)..' space:'..desc.pillar.space..' u:'..desc.u:length()..' dx:'..tostring(dpos)..':'..tostring(desc.pos)..' span:'..tostring(desc.pillar.span))
				local npillar = math.floor((desc.u:length() - 2*marginLeft)/desc.pillar.space)+1
					+ ((desc.u:length() - 2*(desc.pillar.margin + dpos.x)) % desc.pillar.space)/2
				lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mLeft:'..marginLeft..' marg:'..tostring(desc.pillar.margin)..' space:'..desc.pillar.space..' u:'..desc.u:length()..' dx:'..tostring(dpos)..':'..tostring(desc.pos)..' span:'..tostring(desc.pillar.span))
				local npillar = math.floor((desc.u:length() - 2*marginLeft)/desc.pillar.space)+1
					+ ((desc.u:length() - 2*(desc.pillar.margin + dpos.x)) % desc.pillar.space)/2
				lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mLeft:'..marginLeft..' marg:'..tostring(desc.pillar.margin)..' space:'..desc.pillar.space..' u:'..desc.u:length()..' dx:'..tostring(dpos)..':'..tostring(desc.pos)..' span:'..tostring(desc.pillar.span))
				local npillar = math.floor((desc.u:length() - 2*marginLeft)/desc.pillar.space)+1
			local function border(tp, base)
--					if desc.ij[2]==1 then lo('?? border:'..tp..':'..desc.ij[2]..':'..desc[tp].dae..':'..tostring(dpart[desc[tp].dae])) end
				local z = tp == 'roofborder' and desc.v:length() or 0 --desc.v:length() - math.abs(m.fr.z - m.to.z)
					pos.z = desc.pos.z + desc.v:length() - (cdesc.afloor[#cdesc.afloor].top.fat or 0) - 0.01
						lo('??**** border.rbPOS:'..tostring(pos))
				end
				local a = U.vang(U.vturn(desc.u, math.pi/2), m.front, true) - ((desc[tp].inskew and not desc[tp].skew) and desc[tp].inskew or 0)
--				lo('??^^^^^^^^^^____ if_SKEW:'..tostring(desc[tp].skew)..':'..tostring(desc[tp].inskew))
--					desc[tp].inskew = nil
				local a = U.vang(U.vturn(desc.u, math.pi/2), m.front, true) - ((desc[tp].inskew and not desc[tp].skew) and desc[tp].inskew or 0)
--				lo('??^^^^^^^^^^____ if_SKEW:'..tostring(desc[tp].skew)..':'..tostring(desc[tp].inskew))
--					desc[tp].inskew = nil
						local alod = M.daeFrom(cdae)
						lo('??^^^^^^^^^^^^^^_____________ border:'..tostring(m.front)..':'..adesc[cedit.mesh].id,nil,2) --..':'..tostring(desc[tp].daecorner)..' a:'..a..':'..tostring(desc.ij[2]))
						local shift = alod[1].pos or vec3(0,0,0)
						local alod = M.daeFrom(cdae)
						lo('??^^^^^^^^^^^^^^_____________ border:'..tostring(m.front)..':'..adesc[cedit.mesh].id,nil,2) --..':'..tostring(desc[tp].daecorner)..' a:'..a..':'..tostring(desc.ij[2]))
						local shift = alod[1].pos or vec3(0,0,0)
						local alod = M.daeFrom(cdae)
						lo('??^^^^^^^^^^^^^^_____________ border:'..tostring(m.front)..':'..adesc[cedit.mesh].id,nil,2) --..':'..tostring(desc[tp].daecorner)..' a:'..a..':'..tostring(desc.ij[2]))
						local shift = alod[1].pos or vec3(0,0,0)
						local scale = math.sin(math.pi/4)/math.sin(math.pi/4 + desc[tp].skew)
						lo('?? for_NAME:'..desc.ij[2]..' scale:'..scale..' skew:'..desc[tp].skew..' ref:'..tostring(ref)..':'..cdae)
						local pset = {}
							pos, vec3(0,0,a), cforest)
						lo('?? if_CORNER:'..tostring(key)..':'..fout..':'..desc[tp].daecorner)
					else
						if not descnext[tp].skew then
								U.dump(aplinth, '?? if _PPP:'..tostring(base)..':'..tp..':'..tostring(desc[tp].daecorner))
							aplinth[#aplinth][2] = (base and base[desc.ij[2]]:distance(U.mod(desc.ij[2]+1,base)) or desc.u:length()) - ddae[desc[tp].daecorner].to.y
						if not descnext[tp].skew then
								U.dump(aplinth, '?? if _PPP:'..tostring(base)..':'..tp..':'..tostring(desc[tp].daecorner))
							aplinth[#aplinth][2] = (base and base[desc.ij[2]]:distance(U.mod(desc.ij[2]+1,base)) or desc.u:length()) - ddae[desc[tp].daecorner].to.y
--						U.dump(descnext[tp], '?? if_NEXT:')
--							lo('??>>>>>> if_CF:'..tostring(cforest)..':'..tostring(cedit.forest))
						local key = to(desc, desc[tp].daecorner,
--						U.dump(descnext[tp], '?? if_NEXT:')
--							lo('??>>>>>> if_CF:'..tostring(cforest)..':'..tostring(cedit.forest))
						local key = to(desc, desc[tp].daecorner,
						pos + u*p[2], ddae[dae], a)
--						U.dump(list,'??>>>> for_SEGMENT:'..tostring(list and #list or 0))
					if list then
							cedit.forest = ckey
								lo('??>>>>> toCEF:'..tostring(cedit.forest)..':'..tostring(cforest))
						end
							cedit.forest = ckey
								lo('??>>>>> toCEF:'..tostring(cedit.forest)..':'..tostring(cforest))
						end
				if cedit.forest and cedit.foresttype == 'stringcourse' then
--						lo('??>>>>> toCEF_SC:'..tostring(cedit.forest)..':'..tostring(cforest)..':'..tostring(dforest[cedit.forest])..':'..tostring(cedit.foresttype))
					cedit.forest = ckey
				if cedit.forest and cedit.foresttype == 'stringcourse' then
--						lo('??>>>>> toCEF_SC:'..tostring(cedit.forest)..':'..tostring(cforest)..':'..tostring(dforest[cedit.forest])..':'..tostring(cedit.foresttype))
					cedit.forest = ckey
				if cedit.forest and cedit.foresttype == 'stringcourse' then
--						lo('??>>>>> toCEF_SC:'..tostring(cedit.forest)..':'..tostring(cforest)..':'..tostring(dforest[cedit.forest])..':'..tostring(cedit.foresttype))
					cedit.forest = ckey
				if cedit.forest and cedit.foresttype == 'stringcourse' then
--						lo('??>>>>> toCEF_SC:'..tostring(cedit.forest)..':'..tostring(cforest)..':'..tostring(dforest[cedit.forest])..':'..tostring(cedit.foresttype))
					cedit.forest = ckey
		for _,plus in pairs(desc.avplus) do
			lo('??____________________________________ desc_plus:'..tostring(desc.plus))
			if #plus == 3 then
				local v = vec3(x, y, 0)
				if dbg then lo('?? a_b:'..j..':'..tostring(a)..':'..tostring(b)..':'..tostring(x)..':'..tostring(y)) end
				if (a-b):length() + 0.01 > (a-v):length() + (b-v):length() then
				local v = vec3(x, y, 0)
				if dbg then lo('?? a_b:'..j..':'..tostring(a)..':'..tostring(b)..':'..tostring(x)..':'..tostring(y)) end
				if (a-b):length() + 0.01 > (a-v):length() + (b-v):length() then
				local v = vec3(x, y, 0)
				if dbg then lo('?? a_b:'..j..':'..tostring(a)..':'..tostring(b)..':'..tostring(x)..':'..tostring(y)) end
				if (a-b):length() + 0.01 > (a-v):length() + (b-v):length() then
				local v = vec3(x, y, 0)
				if dbg then lo('?? a_b:'..j..':'..tostring(a)..':'..tostring(b)..':'..tostring(x)..':'..tostring(y)) end
				if (a-b):length() + 0.01 > (a-v):length() + (b-v):length() then
					if dbg then
						lo('?? ps.cross:'..i..'>'..j..' x:'..x..' y:'..y..' v1:'..tostring(v1)..' v2:'..tostring(v2))
					end
					if dbg then
						lo('?? ps.cross:'..i..'>'..j..' x:'..x..' y:'..y..' v1:'..tostring(v1)..' v2:'..tostring(v2))
					end
			end
			if dbg then U.dump(sbase, '?? to_RC:'..#sbase..':'..(sbase[1]-sbase[2]):length()..':'..tostring(isvalid)) end
			if isvalid then
	if W.ui.injunction then return end
		lo('>> markUp:'..tostring(forestMeshName)..' fscope:'..tostring(cedit.fscope)..':'..tostring(cedit.forest)..':'..tostring(forestType)..':'..tostring(scope)..':'..tostring(cedit.forest)..' aforest:'..tostring(#cedit.aforest))
	if cedit.forest and dforest[cedit.forest] then
	if W.ui.injunction then return end
		lo('>> markUp:'..tostring(forestMeshName)..' fscope:'..tostring(cedit.fscope)..':'..tostring(cedit.forest)..':'..tostring(forestType)..':'..tostring(scope)..':'..tostring(cedit.forest)..' aforest:'..tostring(#cedit.aforest))
	if cedit.forest and dforest[cedit.forest] then
	if W.ui.injunction then return end
		lo('>> markUp:'..tostring(forestMeshName)..' fscope:'..tostring(cedit.fscope)..':'..tostring(cedit.forest)..':'..tostring(forestType)..':'..tostring(scope)..':'..tostring(cedit.forest)..' aforest:'..tostring(#cedit.aforest))
	if cedit.forest and dforest[cedit.forest] then
	if W.ui.injunction then return end
		lo('>> markUp:'..tostring(forestMeshName)..' fscope:'..tostring(cedit.fscope)..':'..tostring(cedit.forest)..':'..tostring(forestType)..':'..tostring(scope)..':'..tostring(cedit.forest)..' aforest:'..tostring(#cedit.aforest))
	if cedit.forest and dforest[cedit.forest] then
	if W.ui.injunction then return end
		lo('>> markUp:'..tostring(forestMeshName)..' fscope:'..tostring(cedit.fscope)..':'..tostring(cedit.forest)..':'..tostring(forestType)..':'..tostring(scope)..':'..tostring(cedit.forest)..' aforest:'..tostring(#cedit.aforest))
	if cedit.forest and dforest[cedit.forest] then
	if W.ui.injunction then return end
		lo('>> markUp:'..tostring(forestMeshName)..' fscope:'..tostring(cedit.fscope)..':'..tostring(cedit.forest)..':'..tostring(forestType)..':'..tostring(scope)..':'..tostring(cedit.forest)..' aforest:'..tostring(#cedit.aforest))
	if cedit.forest and dforest[cedit.forest] then
	if W.ui.injunction then return end
		lo('>> markUp:'..tostring(forestMeshName)..' fscope:'..tostring(cedit.fscope)..':'..tostring(cedit.forest)..':'..tostring(forestType)..':'..tostring(scope)..':'..tostring(cedit.forest)..' aforest:'..tostring(#cedit.aforest))
	if cedit.forest and dforest[cedit.forest] then
		forBuilding(adesc[id], function(w, ij)
--				U.dump(ijmask, '?? mu_ij0:'..scope..':'..ij[1]..':'..ij[2]..':'..tostring(forall))
			if not tonumber(ij[2]) then
						for _,key in ipairs(list) do
							lo('?? ftype:'..tostring(dforest[key].type))
							if dforest[key].type == forestType then
				else
					lo('!! ERR_markUp.NO_ddae:'..tostring(forestMeshName))
				end
		if #afspline > 0 then
			lo('?? for_AFSPLINE:'..#afspline..':'..tostring(forestMeshName))
			cedit.aforest = afspline
			if cedit and cedit.mesh then
				U.dump(cij, '?? markUp.for_TOP0:'..tostring(cedit.mesh))
				local floor = adesc[cedit.mesh].afloor[cij[1]]
					if child.base then
						lo('??**************** if_ch_base: cchild:'..floor.top.cchild..':'..tostring(child.base)..':'..#child.base..':'..tostring(child.margin),true)
						local base = U.polyMargin(child.base, child.margin or 0)
					if child.base then
						lo('??**************** if_ch_base: cchild:'..floor.top.cchild..':'..tostring(child.base)..':'..#child.base..':'..tostring(child.margin),true)
						local base = U.polyMargin(child.base, child.margin or 0)
			else
				lo('!! ERR_no_cedit:'..tostring(cedit))
			end
		else
			lo('!! ERR_NODDAE_FOR:'..tostring(forestMeshName))
		end
local function roofSet(nm)
	lo('>> roofSet:'..nm..':'..tostring(scope)..':'..tostring(cij[1]))
local function roofSet(nm)
	lo('>> roofSet:'..nm..':'..tostring(scope)..':'..tostring(cij[1]))
		local floor = adesc[cedit.mesh].afloor[cij[1]]
			lo('?? roofSet:'..#floor.top.achild..':'..tostring(floor.top.cchild),true)
		W.floorClear(floor)
			lo('?? roofSet.for_child:'..tostring(floor.top.cchild)..':'..tostring(floor.top.ridge.on))
		if not floor.top.ridge.on and floor.top.cchild ~= nil then
		W.floorClear(floor)
			lo('?? roofSet.for_child:'..tostring(floor.top.cchild)..':'..tostring(floor.top.ridge.on))
		if not floor.top.ridge.on and floor.top.cchild ~= nil then
					local body = floor.top.body
					U.dump(body, '?? for_v12:'..icc..':'..tostring(v1)..':'..tostring(v2))
					if v1:length() > v2:length() then
					local body = floor.top.body
					U.dump(body, '?? for_v12:'..icc..':'..tostring(v1)..':'..tostring(v2))
					if v1:length() > v2:length() then
local function forSpanY(desc, ij, val)
	U.dump(ij, '>> forSpanY:'..tostring(val))
	local w = desc.afloor[ij[1]].awall[ij[2]]
	if not indrag then
		lo('>> roofUp:'..nm..':'..tostring(cij)..' scope:'..tostring(scope)..':'..ifloor..':'..tostring(ichild))
	end
	if not indrag then
		lo('>> roofUp:'..nm..':'..tostring(cij)..' scope:'..tostring(scope)..':'..ifloor..':'..tostring(ichild))
	end
	if not indrag then
		lo('>> roofUp:'..nm..':'..tostring(cij)..' scope:'..tostring(scope)..':'..ifloor..':'..tostring(ichild))
	end
		-- desctop is child
		lo('?? rU_ridge:'..tostring(floor.top.ridge)..' flat:'..tostring(floor.top.ridge.flat)) --..':'..tostring(desctop.ridge.data.av)..':'..tostring(floor.top.tip))
		local valid,data
		-- desctop is child
		lo('?? rU_ridge:'..tostring(floor.top.ridge)..' flat:'..tostring(floor.top.ridge.flat)) --..':'..tostring(desctop.ridge.data.av)..':'..tostring(floor.top.tip))
		local valid,data
		-- desctop is child
		lo('?? rU_ridge:'..tostring(floor.top.ridge)..' flat:'..tostring(floor.top.ridge.flat)) --..':'..tostring(desctop.ridge.data.av)..':'..tostring(floor.top.tip))
		local valid,data
		-- desctop is child
		lo('?? rU_ridge:'..tostring(floor.top.ridge)..' flat:'..tostring(floor.top.ridge.flat)) --..':'..tostring(desctop.ridge.data.av)..':'..tostring(floor.top.tip))
		local valid,data
		if not apair or #apair == 0 then
			lo('!! ERR_roofUp_NORIDGE:'..tostring(ichild))
			return
		local pos = desc.pos + floor.pos
		lo('??______________________________ roofUp_pyramid:'..ifloor..':'..tostring(floor.pos)..':'..tostring(h)..':'..#base..' tip:'..tostring(tip)..' fat:'..tostring(desctop.fat))
		if not tip then tip = tipDefualt(floor) end
		local pos = desc.pos + floor.pos
		lo('??______________________________ roofUp_pyramid:'..ifloor..':'..tostring(floor.pos)..':'..tostring(h)..':'..#base..' tip:'..tostring(tip)..' fat:'..tostring(desctop.fat))
		if not tip then tip = tipDefualt(floor) end
		local pos = desc.pos + floor.pos
		lo('??______________________________ roofUp_pyramid:'..ifloor..':'..tostring(floor.pos)..':'..tostring(h)..':'..#base..' tip:'..tostring(tip)..' fat:'..tostring(desctop.fat))
		if not tip then tip = tipDefualt(floor) end
		local pos = desc.pos + floor.pos
		lo('??______________________________ roofUp_pyramid:'..ifloor..':'..tostring(floor.pos)..':'..tostring(h)..':'..#base..' tip:'..tostring(tip)..' fat:'..tostring(desctop.fat))
		if not tip then tip = tipDefualt(floor) end
		idh = idh or 1
		lo('?? idh:'..idh..':'..tostring(sbase[idh]))
		local d1 = intersectsRay_Plane(sbase[idh], vec3(0,0,1), top, (top-U.mod(idh,base)):cross(U.mod(idh+1,base)-U.mod(idh,base)))
			base = U.polyMargin(base, margin)
				lo('?? rU_base_shed:'..#base..':'..ifirst..':'..tostring(desctop.istart),true)
			local arc,map = coverUp(base)
					else
						lo('!! ERR_NO_SDH:'..ifirst..'/'..i..':'..tostring(sbase[i])..':'..tostring(U.mod(ifirst,sbase))..':'..tostring(U.mod(ifirst+1,sbase)),true)
					end
					else
						lo('!! ERR_NO_SDH:'..ifirst..'/'..i..':'..tostring(sbase[i])..':'..tostring(U.mod(ifirst,sbase))..':'..tostring(U.mod(ifirst+1,sbase)),true)
					end
					else
						lo('!! ERR_NO_SDH:'..ifirst..'/'..i..':'..tostring(sbase[i])..':'..tostring(U.mod(ifirst,sbase))..':'..tostring(U.mod(ifirst+1,sbase)),true)
					end
		rbdae = desctop.roofborder[1] or desctop.roofborder
	--            lo('?? FOR_RB:'..tostring(rbdae)..':'..desctop.mat..':'..tostring(desctop.roofborder[2]))
		if toedit == nil and desctop.roofborder[2] then
		rbdae = desctop.roofborder[1] or desctop.roofborder
	--            lo('?? FOR_RB:'..tostring(rbdae)..':'..desctop.mat..':'..tostring(desctop.roofborder[2]))
		if toedit == nil and desctop.roofborder[2] then
		L,dL,dC = ddae[rbdae].to.x - ddae[rbdae].fr.x, 0.6, 0.105
--            U.dump(desctop.av, '?? for_AV:'..tostring(ddae[rbdae].fr)..':'..tostring(ddae[rbdae].to)..':'..L)
	end
		L,dL,dC = ddae[rbdae].to.x - ddae[rbdae].fr.x, 0.6, 0.105
--            U.dump(desctop.av, '?? for_AV:'..tostring(ddae[rbdae].fr)..':'..tostring(ddae[rbdae].to)..':'..L)
	end
	--                    for i,v in pairs(dsc.av) do
	--                        lo('?? for_v:'..i..':'..tostring(v-desc.pos))
	--                    end
local function houseUp(desc, toedit, update, prn, fordae)
		lo('>>**************** houseUp:'..tostring(desc)..':'..tostring(toedit)..' prn:'..tostring(prn)..':'..tostring(update)..':'..tostring(desc and desc.prn or nil)..' nfloors:'..tostring(desc and #desc.afloor or nil)..':'..tostring(cedit.forest)..':'..tableSize(adesc)) --..tostring(scenetree.findClassObjects('Roads33'))..':'..tostring(scenetree.findObject("Vegetation")))
	local om
local function houseUp(desc, toedit, update, prn, fordae)
		lo('>>**************** houseUp:'..tostring(desc)..':'..tostring(toedit)..' prn:'..tostring(prn)..':'..tostring(update)..':'..tostring(desc and desc.prn or nil)..' nfloors:'..tostring(desc and #desc.afloor or nil)..':'..tostring(cedit.forest)..':'..tableSize(adesc)) --..tostring(scenetree.findClassObjects('Roads33'))..':'..tostring(scenetree.findObject("Vegetation")))
	local om
local function houseUp(desc, toedit, update, prn, fordae)
		lo('>>**************** houseUp:'..tostring(desc)..':'..tostring(toedit)..' prn:'..tostring(prn)..':'..tostring(update)..':'..tostring(desc and desc.prn or nil)..' nfloors:'..tostring(desc and #desc.afloor or nil)..':'..tostring(cedit.forest)..':'..tableSize(adesc)) --..tostring(scenetree.findClassObjects('Roads33'))..':'..tostring(scenetree.findObject("Vegetation")))
	local om
local function houseUp(desc, toedit, update, prn, fordae)
		lo('>>**************** houseUp:'..tostring(desc)..':'..tostring(toedit)..' prn:'..tostring(prn)..':'..tostring(update)..':'..tostring(desc and desc.prn or nil)..' nfloors:'..tostring(desc and #desc.afloor or nil)..':'..tostring(cedit.forest)..':'..tableSize(adesc)) --..tostring(scenetree.findClassObjects('Roads33'))..':'..tostring(scenetree.findObject("Vegetation")))
	local om
local function houseUp(desc, toedit, update, prn, fordae)
		lo('>>**************** houseUp:'..tostring(desc)..':'..tostring(toedit)..' prn:'..tostring(prn)..':'..tostring(update)..':'..tostring(desc and desc.prn or nil)..' nfloors:'..tostring(desc and #desc.afloor or nil)..':'..tostring(cedit.forest)..':'..tableSize(adesc)) --..tostring(scenetree.findClassObjects('Roads33'))..':'..tostring(scenetree.findObject("Vegetation")))
	local om
local function houseUp(desc, toedit, update, prn, fordae)
		lo('>>**************** houseUp:'..tostring(desc)..':'..tostring(toedit)..' prn:'..tostring(prn)..':'..tostring(update)..':'..tostring(desc and desc.prn or nil)..' nfloors:'..tostring(desc and #desc.afloor or nil)..':'..tostring(cedit.forest)..':'..tableSize(adesc)) --..tostring(scenetree.findClassObjects('Roads33'))..':'..tostring(scenetree.findObject("Vegetation")))
	local om
local function houseUp(desc, toedit, update, prn, fordae)
		lo('>>**************** houseUp:'..tostring(desc)..':'..tostring(toedit)..' prn:'..tostring(prn)..':'..tostring(update)..':'..tostring(desc and desc.prn or nil)..' nfloors:'..tostring(desc and #desc.afloor or nil)..':'..tostring(cedit.forest)..':'..tableSize(adesc)) --..tostring(scenetree.findClassObjects('Roads33'))..':'..tostring(scenetree.findObject("Vegetation")))
	local om
local function houseUp(desc, toedit, update, prn, fordae)
		lo('>>**************** houseUp:'..tostring(desc)..':'..tostring(toedit)..' prn:'..tostring(prn)..':'..tostring(update)..':'..tostring(desc and desc.prn or nil)..' nfloors:'..tostring(desc and #desc.afloor or nil)..':'..tostring(cedit.forest)..':'..tableSize(adesc)) --..tostring(scenetree.findClassObjects('Roads33'))..':'..tostring(scenetree.findObject("Vegetation")))
	local om
local function houseUp(desc, toedit, update, prn, fordae)
		lo('>>**************** houseUp:'..tostring(desc)..':'..tostring(toedit)..' prn:'..tostring(prn)..':'..tostring(update)..':'..tostring(desc and desc.prn or nil)..' nfloors:'..tostring(desc and #desc.afloor or nil)..':'..tostring(cedit.forest)..':'..tableSize(adesc)) --..tostring(scenetree.findClassObjects('Roads33'))..':'..tostring(scenetree.findObject("Vegetation")))
	local om
		if not desc then
		lo('!! houseUp_NODESC:'..tostring(toedit)..':'..tableSize(adesc)..':'..tostring(adesc[tonumber(toedit)])..':'..tostring(adesc[toedit..'']))
	--      for k,d in pairs(adesc) do
		if not desc then
		lo('!! houseUp_NODESC:'..tostring(toedit)..':'..tableSize(adesc)..':'..tostring(adesc[tonumber(toedit)])..':'..tostring(adesc[toedit..'']))
	--      for k,d in pairs(adesc) do
		if not desc then
		lo('!! houseUp_NODESC:'..tostring(toedit)..':'..tableSize(adesc)..':'..tostring(adesc[tonumber(toedit)])..':'..tostring(adesc[toedit..'']))
	--      for k,d in pairs(adesc) do
				if wp.id then
--                        lo('?? to_DEL:'..k..':'..tostring(scenetree.findObjectById(wp.id)))
					scenetree.findObjectById(wp.id):delete()
		end
--            lo('?? f_dirt:'..i..':'..tostring(dirty))
			lo('??++++ FLOOR: '..i..'/'..#desc.afloor..' walls:'..#f.awall..':'..tostring(prn)..':'..tostring(desc.prn)..' achild:'..tostring((f.top and f.top.achild and #f.top.achild) or nil)) --..':'..tostring(desc.prn and adesc[desc.prn].pos or nil))
--            lo('?? f_dirt:'..i..':'..tostring(dirty))
			lo('??++++ FLOOR: '..i..'/'..#desc.afloor..' walls:'..#f.awall..':'..tostring(prn)..':'..tostring(desc.prn)..' achild:'..tostring((f.top and f.top.achild and #f.top.achild) or nil)) --..':'..tostring(desc.prn and adesc[desc.prn].pos or nil))
		local p = desc.pos + f.pos + f.base[1]
--            lo('?? f_dirt:'..i..':'..tostring(dirty))
			lo('??++++ FLOOR: '..i..'/'..#desc.afloor..' walls:'..#f.awall..':'..tostring(prn)..':'..tostring(desc.prn)..' achild:'..tostring((f.top and f.top.achild and #f.top.achild) or nil)) --..':'..tostring(desc.prn and adesc[desc.prn].pos or nil))
		local p = desc.pos + f.pos + f.base[1]
--            lo('?? f_dirt:'..i..':'..tostring(dirty))
			lo('??++++ FLOOR: '..i..'/'..#desc.afloor..' walls:'..#f.awall..':'..tostring(prn)..':'..tostring(desc.prn)..' achild:'..tostring((f.top and f.top.achild and #f.top.achild) or nil)) --..':'..tostring(desc.prn and adesc[desc.prn].pos or nil))
		local p = desc.pos + f.pos + f.base[1]
--            lo('?? f_dirt:'..i..':'..tostring(dirty))
			lo('??++++ FLOOR: '..i..'/'..#desc.afloor..' walls:'..#f.awall..':'..tostring(prn)..':'..tostring(desc.prn)..' achild:'..tostring((f.top and f.top.achild and #f.top.achild) or nil)) --..':'..tostring(desc.prn and adesc[desc.prn].pos or nil))
		local p = desc.pos + f.pos + f.base[1]
			for _,c in pairs(f.achild) do
					lo('?? child_id:'..tostring(c.id)..':'..tostring(c.prn),true)
--                    U.dump(c,'?? child_id:'..tostring(c.id)..':'..tostring(c.prn),true)
			for _,c in pairs(f.achild) do
					lo('?? child_id:'..tostring(c.id)..':'..tostring(c.prn),true)
--                    U.dump(c,'?? child_id:'..tostring(c.id)..':'..tostring(c.prn),true)
					lo('?? child_id:'..tostring(c.id)..':'..tostring(c.prn),true)
--                    U.dump(c,'?? child_id:'..tostring(c.id)..':'..tostring(c.prn),true)
--                c.prn = f
					lo('?? child_id:'..tostring(c.id)..':'..tostring(c.prn),true)
--                    U.dump(c,'?? child_id:'..tostring(c.id)..':'..tostring(c.prn),true)
--                c.prn = f
		end
--				lo('?? pre_WALLS:'..tostring(#am))
		-- SPLINES
			local preceaf = #cedit.aforest
				lo('?? if_SPLINE:'..i..':'..#desc.aspline..':'..#cedit.aforest) --..':'..tostring(s))
			for k,s in pairs(desc.aspline[i]) do
				local mbody,afpos,base,aforest,invalid = W.splineUp(desc, ij[1], ij[2], s) -- s.id and s.base or nil)
--					U.dump(s, '?? to_SPLINE:'..tostring(mbody)..':'..#s.aforest) --..':'..tostring(mbody))
				if M.valid({mbody}) then
				local mbody,afpos,base,aforest,invalid = W.splineUp(desc, ij[1], ij[2], s) -- s.id and s.base or nil)
--					U.dump(s, '?? to_SPLINE:'..tostring(mbody)..':'..#s.aforest) --..':'..tostring(mbody))
				if M.valid({mbody}) then
				if M.valid({mbody}) then
						lo('??__________^^^^^^^^^^^^^^^^^^^^^ SPLINED:'..#aforest..'/'..#afpos..':'..tostring(invalid))
--						U.dump(cij, '?? CIJ:')
						local id,om = meshUp({mbody}, 'spline', groupEdit)
--							lo('?? sPLINED:'..k..':'..tostring(id))
						s.id = id
							local ang = 0*math.pi + U.vang(d[2]-d[1],vec3(1,0,0),true)
		--						lo('?? for_ff:'.._..':'..tostring(desc.aspline[i][k]))
							if not aforest[fi].skip then
					lo('?? post_AF:'..#cedit.aforest)
--					U.dump(desc.aspline, '?? for_SPLINE:'..k..':'..#am..':'..tostring(mbody))
--				am[#am+1] = mbody
								if dirty then
										--lo('??^^^^^^^^^^^^ if_WID:'..tostring(w.id))
									local wo = scenetree.findObjectById(w.id)
			end
--                lo('?? w_upd:'..i..':'..j..':'..tostring(w.update)..'/'..tostring(dirty))
			if w.update then
			end
--                lo('?? w_upd:'..i..':'..j..':'..tostring(w.update)..'/'..tostring(dirty))
			if w.update then
			for k = 1,spany do
--                    lo('?? hu.for_wall:'..i..':'..j..':'..k..' span:'..tostring(w.spany), true)
--                    if w.win and w.df and w.df[w.win] then
				end
--					lo('?? wallPOS:'..i..':'..j..':'..tostring(w.pos)..':'..tostring(p))
--					U.dump(w, '?? for_WALL:')
				end
--					lo('?? wallPOS:'..i..':'..j..':'..tostring(w.pos)..':'..tostring(p))
--					U.dump(w, '?? for_WALL:')
				av,af,an,auv,mhole,arcext = wallUp(w, desc, k) --, (i==2 and j==5 and true) or false)
--            U.dump(arcext, '?? if_ARCEXT: wall:'..j..':'..tostring(#arcext))
				if arcext and #arcext>0 then
			--                  if je == 1 and k == 1 then
			--                    lo('?? for_ch:'..tostring(rc[1])..':'..tostring(b)..':'..tostring(U.mod(je+1,base)))
			--                  end
			--                  if je == 1 and k == 1 then
			--                    lo('?? for_ch:'..tostring(rc[1])..':'..tostring(b)..':'..tostring(U.mod(je+1,base)))
			--                  end
			--                  if je == 1 and k == 1 then
			--                    lo('?? for_ch:'..tostring(rc[1])..':'..tostring(b)..':'..tostring(U.mod(je+1,base)))
			--                  end
						for k,rc in pairs(arcext) do
			--                      lo('?? to_check:'..tostring(base[je])..':'..tostring(U.mod(je+1,base))..'<'..tostring(f.base[j]+(w.u:normalized()*rc[1].x)))
							if U.between(base[je]+dfpos,U.mod(je+1,base)+dfpos,
						for k,rc in pairs(arcext) do
			--                      lo('?? to_check:'..tostring(base[je])..':'..tostring(U.mod(je+1,base))..'<'..tostring(f.base[j]+(w.u:normalized()*rc[1].x)))
							if U.between(base[je]+dfpos,U.mod(je+1,base)+dfpos,
						for k,rc in pairs(arcext) do
			--                      lo('?? to_check:'..tostring(base[je])..':'..tostring(U.mod(je+1,base))..'<'..tostring(f.base[j]+(w.u:normalized()*rc[1].x)))
							if U.between(base[je]+dfpos,U.mod(je+1,base)+dfpos,
								end
			--                        U.dump(rc, '?? to_WALL:'..je..':'..k..':'..tostring(U.mod(j+1,f.base) - f.base[j]))
								we.arcext[#we.arcext+1] = rc
			--                  if we.arcext then
			--                    U.dump(base,'?? for_WEE:'..je..':'..tostring(base[je])..'>'..tostring(base[je+1])..we.ij[1]..':'..we.ij[2]..':'..#we.arcext..':'..tostring(we.u))
			--                  end
			--                  if we.arcext then
			--                    U.dump(base,'?? for_WEE:'..je..':'..tostring(base[je])..'>'..tostring(base[je+1])..we.ij[1]..':'..we.ij[2]..':'..#we.arcext..':'..tostring(we.u))
			--                  end
			--                  if we.arcext then
			--                    U.dump(base,'?? for_WEE:'..je..':'..tostring(base[je])..'>'..tostring(base[je+1])..we.ij[1]..':'..we.ij[2]..':'..#we.arcext..':'..tostring(we.u))
			--                  end
						bote = base2ext(base, botext)
			--                  lo('?? if_HCH:'..i..':'..j..':'..tostring(f.top.achild and #f.top.achild or nil)..':'..tostring(bote))
						if f.top.achild and #f.top.achild>0 then
						bote = base2ext(base, botext)
			--                  lo('?? if_HCH:'..i..':'..j..':'..tostring(f.top.achild and #f.top.achild or nil)..':'..tostring(bote))
						if f.top.achild and #f.top.achild>0 then
			--                        U.dump(botext[je],'??__________+++++++++++++++ be_CHECK:'..k..':'..je..':'..icb)
			--                        U.dump(c.base, '?? child_BASE:'..tostring(c.base[icb])..':'..tostring(U.mod(icb+1,c.base)))
								for ie=1,#botext[je],4 do
			--                        U.dump(botext[je],'??__________+++++++++++++++ be_CHECK:'..k..':'..je..':'..icb)
			--                        U.dump(c.base, '?? child_BASE:'..tostring(c.base[icb])..':'..tostring(U.mod(icb+1,c.base)))
								for ie=1,#botext[je],4 do
									{botext[je][ie],botext[je][ie+3]},U.small_val) then
			--                                lo('?? match:'..k..':'..ie..':'..icb..':'..tostring(botext[je][ie])..':'..tostring(botec and #botec or nil))
										if not botec then
									{botext[je][ie],botext[je][ie+3]},U.small_val) then
			--                                lo('?? match:'..k..':'..ie..':'..icb..':'..tostring(botext[je][ie])..':'..tostring(botec and #botec or nil))
										if not botec then
						else
			--                    lo('?? for_FULL:'..tostring(bote))
							f.topext = bote
						desc.afloor[i+1].botext = bote
			--                lo('?? if_child:'..tostring(f.top.achild and #f.top.achild or nil)..':'..tostring(bote))
					end
						desc.afloor[i+1].botext = bote
			--                lo('?? if_child:'..tostring(f.top.achild and #f.top.achild or nil)..':'..tostring(bote))
					end
						if i==2 and j == 2 then
							U.dump(an, '??++++++++++++ for_WALL_an:'..j..':'..tostring(w.pos)..':'..#av..':'..#af)
							U.dump(av, '?? av:')
]]
--                        U.dump(av, '?? for_WALL:'..j..':'..tostring(w.pos))
--                    lo('?? postWU:'..#am..':'..#av)
						for _,key in ipairs(list) do
	--                        lo('?? for_key:'..key..':'..tostring(dforest[key]))
							dforest[key].mesh = toedit
--                        if i == 2 and j == 2 then
--                            lo('??^^^^^^^^^^^^^ test_AM:'..#am) --..':'..tostring(#mhole.faces))
--                        end
					if w.fringe.h < 0 then
--                            lo('?? for_u:'..tostring(u)..':'..tostring(w.u))
						av, af = M.rect(u, w.v:normalized()*w.fringe.h, nil, nil,
					if w.fringe.h < 0 then
--                            lo('?? for_u:'..tostring(u)..':'..tostring(w.u))
						av, af = M.rect(u, w.v:normalized()*w.fringe.h, nil, nil,
			end
--                lo('?? postWU2:'..#am..':'..#av..':'..tostring(dirty))
--            wallUp(p + vec3(0, 0, cheight), w, 'o_wall_'..i..'_'..j)

--          lo('?? pre_cam:'..i..':'..j..':'..#am..':'..spany..':'..tostring(dirty), true)
--            if #av>0 then
--                inedit = true
--                        lo('?? for_wall:'..tostring(w.id)..':'..i..':'..j)
				local wall = scenetree.findObjectById(w.id)
				else
						lo('!! ERR_WALL:'..i..':'..j..':'..tostring(w.id)..':'..#am..':'..tostring(w.splined)..':'..tostring(am[1].verts)) --..':'..tostring(w.splined.mat))
					if w.splined then
				else
						lo('!! ERR_WALL:'..i..':'..j..':'..tostring(w.id)..':'..#am..':'..tostring(w.splined)..':'..tostring(am[1].verts)) --..':'..tostring(w.splined.mat))
					if w.splined then
				else
						lo('!! ERR_WALL:'..i..':'..j..':'..tostring(w.id)..':'..#am..':'..tostring(w.splined)..':'..tostring(am[1].verts)) --..':'..tostring(w.splined.mat))
					if w.splined then
				else
						lo('!! ERR_WALL:'..i..':'..j..':'..tostring(w.id)..':'..#am..':'..tostring(w.splined)..':'..tostring(am[1].verts)) --..':'..tostring(w.splined.mat))
					if w.splined then
						w.id = meshUp(cam, 'wall', groupEdit)
							lo('?? WS_WIN:'..tostring(w.win))
					end
				end
--                lo('?? for_edit:'..tostring(groupEdit))
				local id,om = meshUp(cam, 'wall', groupEdit)
		end
--			lo('?? for_AM:'..tostring(#am))
-------------------------
		if f.top ~= nil and not desc.isbox then
--          lo('??++++++++++++++============ if_EXT:'..i..tostring(f.topext),true)
--                lo('?? shape: '..tostring(f.top.shape),true) --..':'..tostring(#f.top.achild)..':'..tostring(f.top.cchild)) --..':'..tostring(desc.pos)..':'..tostring(f.pos)..':'..tostring(f.base[1]))
--          lo('??++++++++++++++============ if_EXT:'..i..tostring(f.topext),true)
--                lo('?? shape: '..tostring(f.top.shape),true) --..':'..tostring(#f.top.achild)..':'..tostring(f.top.cchild)) --..':'..tostring(desc.pos)..':'..tostring(f.pos)..':'..tostring(f.base[1]))
			-- ROOF
--          lo('??++++++++++++++============ if_EXT:'..i..tostring(f.topext),true)
--                lo('?? shape: '..tostring(f.top.shape),true) --..':'..tostring(#f.top.achild)..':'..tostring(f.top.cchild)) --..':'..tostring(desc.pos)..':'..tostring(f.pos)..':'..tostring(f.base[1]))
			-- ROOF
--          lo('??++++++++++++++============ if_EXT:'..i..tostring(f.topext),true)
--                lo('?? shape: '..tostring(f.top.shape),true) --..':'..tostring(#f.top.achild)..':'..tostring(f.top.cchild)) --..':'..tostring(desc.pos)..':'..tostring(f.pos)..':'..tostring(f.base[1]))
			-- ROOF
--          lo('??++++++++++++++============ if_EXT:'..i..tostring(f.topext),true)
--                lo('?? shape: '..tostring(f.top.shape),true) --..':'..tostring(#f.top.achild)..':'..tostring(f.top.cchild)) --..':'..tostring(desc.pos)..':'..tostring(f.pos)..':'..tostring(f.base[1]))
			-- ROOF
--          lo('??++++++++++++++============ if_EXT:'..i..tostring(f.topext),true)
--                lo('?? shape: '..tostring(f.top.shape),true) --..':'..tostring(#f.top.achild)..':'..tostring(f.top.cchild)) --..':'..tostring(desc.pos)..':'..tostring(f.pos)..':'..tostring(f.base[1]))
			-- ROOF
--          lo('??++++++++++++++============ if_EXT:'..i..tostring(f.topext),true)
--                lo('?? shape: '..tostring(f.top.shape),true) --..':'..tostring(#f.top.achild)..':'..tostring(f.top.cchild)) --..':'..tostring(desc.pos)..':'..tostring(f.pos)..':'..tostring(f.base[1]))
			-- ROOF
			end
					if not indrag then lo('?? for_cover: i='..i..' ifchild:'..#f.top.achild..':'..cheight..':'..tostring(forsplit)..':'..tostring(dirty)..':'..#f.top.achild) end
			for _,w in pairs(f.awall) do
			end
					if not indrag then lo('?? for_cover: i='..i..' ifchild:'..#f.top.achild..':'..cheight..':'..tostring(forsplit)..':'..tostring(dirty)..':'..#f.top.achild) end
			for _,w in pairs(f.awall) do
--            if false and f.top.ridge.on then
--                    lo('?? hU_ridge:'..tostring(f.top.ridge.flat),true)
				local auvdim = {}
				local isvalid = T.forRidge(f,nil,nil,(f.top.istart-1)%2)
					lo('??^^^^^^^^^^^^^^ hU.RIDGE:'..i..':'..tostring(isvalid)..':'..#f.top.achild..' istart:'..f.top.istart,true)
--                    U.dump(f.top.achild, '?? chDATA:')
--                    U.dump(f.top, '??_________________if_RIDGE:')
--                    lo('?? hU_ridge2:'..tostring(f.top.ridge.flat),true)
			end
			end
--                lo('??***************** for_BOT:'..i..':'..tostring(f.pos)..':'..cheight)
			local hprn = prn and forHeight(prn.afloor, desc.floor-1) or 0
			local hprn = prn and forHeight(prn.afloor, desc.floor-1) or 0
					if prn then lo('??^^^^^^^^^^ BOT_PRN: floor:'..desc.floor..':'..cij[1]..':'..hprn..':'..#prn.afloor..':'..tostring(cheight),true) end
--          U.dump(f.botext, '??__________ if_BE:'..i)
			for i=1,#av do
				lo('??^^^^^^^^^^^^^^^ for_PRN:'..i..':'..tostring(desc.prn)..':'..tostring(prn and prn.pos or nil))
--                av[i] = av[i] +
			for i=1,#av do
				lo('??^^^^^^^^^^^^^^^ for_PRN:'..i..':'..tostring(desc.prn)..':'..tostring(prn and prn.pos or nil))
--                av[i] = av[i] +
			local function toRender(dsc, adata, lbl, ischild)
--                    lo('>>******** toRender:'..lbl..':'..#adata) --..tostring(forsplit)..':'..tostring(dirty)..' id:'..tostring(dsc.id),true)
--                if forsplit or (ischild and dsc.id == nil) then
			local function toRender(dsc, adata, lbl, ischild)
--                    lo('>>******** toRender:'..lbl..':'..#adata) --..tostring(forsplit)..':'..tostring(dirty)..' id:'..tostring(dsc.id),true)
--                if forsplit or (ischild and dsc.id == nil) then
			local function toRender(dsc, adata, lbl, ischild)
--                    lo('>>******** toRender:'..lbl..':'..#adata) --..tostring(forsplit)..':'..tostring(dirty)..' id:'..tostring(dsc.id),true)
--                if forsplit or (ischild and dsc.id == nil) then
					if id then
	--                        lo('?? for_ID:'..tostring(id),true) --..tostring(id)..':'..tostring(adata[1])..':'..tostring(mdata),true)
						aedit[id] = {mesh = mdata or adata[1], desc = dsc} -- {ij = {i,nil}, type = 'cover'}}
					if id then
	--                        lo('?? for_ID:'..tostring(id),true) --..tostring(id)..':'..tostring(adata[1])..':'..tostring(mdata),true)
						aedit[id] = {mesh = mdata or adata[1], desc = dsc} -- {ij = {i,nil}, type = 'cover'}}
					if id then
	--                        lo('?? for_ID:'..tostring(id),true) --..tostring(id)..':'..tostring(adata[1])..':'..tostring(mdata),true)
						aedit[id] = {mesh = mdata or adata[1], desc = dsc} -- {ij = {i,nil}, type = 'cover'}}
					if id then
	--                        lo('?? for_ID:'..tostring(id),true) --..tostring(id)..':'..tostring(adata[1])..':'..tostring(mdata),true)
						aedit[id] = {mesh = mdata or adata[1], desc = dsc} -- {ij = {i,nil}, type = 'cover'}}
--                        if dsc.ridge.on then
--                            U.dump(adata,'?? r2_data:'..tostring(dsc.id)..':'..tostring(dsc.shape)..':'..tostring(obj)..':'..tostring(dsc.ridge),true)
--                        end
--                        if dsc.ridge.on then
--                            U.dump(adata,'?? r2_data:'..tostring(dsc.id)..':'..tostring(dsc.shape)..':'..tostring(obj)..':'..tostring(dsc.ridge),true)
--                        end
--                        if dsc.ridge.on then
--                            U.dump(adata,'?? r2_data:'..tostring(dsc.id)..':'..tostring(dsc.shape)..':'..tostring(obj)..':'..tostring(dsc.ridge),true)
--                        end
--                        if dsc.ridge.on then
--                            U.dump(adata,'?? r2_data:'..tostring(dsc.id)..':'..tostring(dsc.shape)..':'..tostring(obj)..':'..tostring(dsc.ridge),true)
--                        end
					else
						lo('!! ERR.houseUp_NOTOPCHILD:'..tostring(dsc.id),true)
					end
--                        lo('?? r3:',true)
--                        lo('?? mesh_SOLID:'..tostring(dsc.id),true)
					-- to solid building
			end
--                lo('?? for_TOP3:'..tostring(desctop.adata))
--??            if not ({gable=1,shed=1})[f.top.shape] and #f.top.achild > 0 then
					lo('?? with_CHILD:'..i..':'..#f.top.achild..':'..tostring(f.top.ridge.on)..':'..tostring(dirty), true) --..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(f.top.id))
        		local asi
--??            if not ({gable=1,shed=1})[f.top.shape] and #f.top.achild > 0 then
					lo('?? with_CHILD:'..i..':'..#f.top.achild..':'..tostring(f.top.ridge.on)..':'..tostring(dirty), true) --..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(f.top.id))
        		local asi
--??            if not ({gable=1,shed=1})[f.top.shape] and #f.top.achild > 0 then
					lo('?? with_CHILD:'..i..':'..#f.top.achild..':'..tostring(f.top.ridge.on)..':'..tostring(dirty), true) --..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(f.top.id))
        		local asi
--??            if not ({gable=1,shed=1})[f.top.shape] and #f.top.achild > 0 then
					lo('?? with_CHILD:'..i..':'..#f.top.achild..':'..tostring(f.top.ridge.on)..':'..tostring(dirty), true) --..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(f.top.id))
        		local asi
--??            if not ({gable=1,shed=1})[f.top.shape] and #f.top.achild > 0 then
					lo('?? with_CHILD:'..i..':'..#f.top.achild..':'..tostring(f.top.ridge.on)..':'..tostring(dirty), true) --..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(f.top.id))
        		local asi
				for ic,c in pairs(f.top.achild) do
							lo('?? for_CHILD:'..ic..':'..tostring(c.shape)..':'..tostring(c.fat))
--                    U.dump(c, '?? for_CHILD:'..ic)
				for ic,c in pairs(f.top.achild) do
							lo('?? for_CHILD:'..ic..':'..tostring(c.shape)..':'..tostring(c.fat))
--                    U.dump(c, '?? for_CHILD:'..ic)
					c = f.top.achild[ic]
--                        lo('?? if_RIDGE:'..ic..':'..tostring(c.ridge and c.ridge.on or nil))
					if c.ridge and c.ridge.on then
						end
							lo('??+++++++++++++++++++++++ for_child_ridge:'..ic..':'..tostring(c.shape)..' fat:'..tostring(c.fat),true)
--                        U.dump(f.top.achild[1].ridge.data,'??+++++++++++++++++++++++ for_child_ridge:'..ic)
						end
							lo('??+++++++++++++++++++++++ for_child_ridge:'..ic..':'..tostring(c.shape)..' fat:'..tostring(c.fat),true)
--                        U.dump(f.top.achild[1].ridge.data,'??+++++++++++++++++++++++ for_child_ridge:'..ic)
--                            local c = f.top.achild[ic]
--                            U.dump(c.base, '?? pre_rup:'..i..':'..ic..':'..tostring(c.id)..':'..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(c.shape), true)
--                        lo('??^^^^^^^^^^ hU_pre_rU:'..c.shape..':'..c.istart,true)
--                            local c = f.top.achild[ic]
--                            U.dump(c.base, '?? pre_rup:'..i..':'..ic..':'..tostring(c.id)..':'..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(c.shape), true)
--                        lo('??^^^^^^^^^^ hU_pre_rU:'..c.shape..':'..c.istart,true)
--                            local c = f.top.achild[ic]
--                            U.dump(c.base, '?? pre_rup:'..i..':'..ic..':'..tostring(c.id)..':'..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(c.shape), true)
--                        lo('??^^^^^^^^^^ hU_pre_rU:'..c.shape..':'..c.istart,true)
--                            local c = f.top.achild[ic]
--                            U.dump(c.base, '?? pre_rup:'..i..':'..ic..':'..tostring(c.id)..':'..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(c.shape), true)
--                        lo('??^^^^^^^^^^ hU_pre_rU:'..c.shape..':'..c.istart,true)
          			mdata = amdata and amdata[1] or nil
--                        U.dump(mdata, '?? hU_post_rU:'..tostring(mdata)..':'..tostring(c.shape),true)
--                        if c.shape == 'gable' then
          			mdata = amdata and amdata[1] or nil
--                        U.dump(mdata, '?? hU_post_rU:'..tostring(mdata)..':'..tostring(c.shape),true)
--                        if c.shape == 'gable' then
--                        if c.shape == 'gable' then
--                            U.dump(c,'?? for_TOP_child:'..ic..':'..tostring(c.shape)..':'..tostring(c.adata and #c.adata or nil),true)
--                        end
--                        if c.shape == 'gable' then
--                            U.dump(c,'?? for_TOP_child:'..ic..':'..tostring(c.shape)..':'..tostring(c.adata and #c.adata or nil),true)
--                        end
						end
--                                U.dump(subdata, '??^^^^^^^^^^^^^ SUBDATA:'..tostring(c.id)..':'..tostring(forsplit))
					end
						end
--                                U.dump(subdata, '??^^^^^^^^^^^^^ SUBDATA:'..tostring(c.id)..':'..tostring(forsplit))
					end
--                    if U._PRD == 0 and c.shape == 'gable' then
--                            U.dump(desctop.adata, '?? for_child_Gable:'..#desctop.adata..':'..c.shape..':'..tostring(desctop.id..':'..tostring(dirty)))
--                            desctop.id = nil
--                    if U._PRD == 0 and c.shape == 'gable' then
--                            U.dump(desctop.adata, '?? for_child_Gable:'..#desctop.adata..':'..c.shape..':'..tostring(desctop.id..':'..tostring(dirty)))
--                            desctop.id = nil
						toRender(c, am, 'lid', true)
--                        U.dump(c, '??_______________ for_CHILD:'..ic..':'..tostring(c.shape)..':'..tostring(c.fat)..':'..tostring(mdata))
					elseif mdata then
						toRender(c, am, 'lid', true)
--                        U.dump(c, '??_______________ for_CHILD:'..ic..':'..tostring(c.shape)..':'..tostring(c.fat)..':'..tostring(mdata))
					elseif mdata then
						toRender(c, am, 'lid', true)
--                        U.dump(c, '??_______________ for_CHILD:'..ic..':'..tostring(c.shape)..':'..tostring(c.fat)..':'..tostring(mdata))
					elseif mdata then
--                        local data = subdata and {mdata,subdata} or {mdata}
--                            lo('?? preRender:'..ic..':'..c.shape..':'..tostring(subdata and tableSize(subdata) or nil)..':'..tostring(data and tableSize(data) or nil))
--                            U.dump(data, '?? preRender_d:'..ic..':'..tostring(data and tableSize(data) or nil))
--                        local data = subdata and {mdata,subdata} or {mdata}
--                            lo('?? preRender:'..ic..':'..c.shape..':'..tostring(subdata and tableSize(subdata) or nil)..':'..tostring(data and tableSize(data) or nil))
--                            U.dump(data, '?? preRender_d:'..ic..':'..tostring(data and tableSize(data) or nil))
--                            lo('?? preRender:'..ic..':'..c.shape..':'..tostring(subdata and tableSize(subdata) or nil)..':'..tostring(data and tableSize(data) or nil))
--                            U.dump(data, '?? preRender_d:'..ic..':'..tostring(data and tableSize(data) or nil))
--							lo('??^^^^^^^^^^^^^^^^^^^^^^^^ pre_TORENDER:')
--                        toRender(c, data, 'lid', true)
--                            U.dump(c, '?? post_render0:'..ic..':'..tostring(c.id),true)
--                            U.dump(f.top.achild, '?? post_render:'..ic..':'..tostring(c.id),true)
--                            U.dump(c, '?? post_render0:'..ic..':'..tostring(c.id),true)
--                            U.dump(f.top.achild, '?? post_render:'..ic..':'..tostring(c.id),true)
						if c.id then
	--                            lo('?? for_child:'..tostring(c.id), true)
							if not aedit[c.id] then
					end
--                            lo('?? post_rup:'..tostring(c.id)..':'..tostring(forsplit)..':'..tostring(dirty))
				end
					end
--                            lo('?? post_rup:'..tostring(c.id)..':'..tostring(forsplit)..':'..tostring(dirty))
				end
					end
--                            lo('?? post_rup:'..tostring(c.id)..':'..tostring(forsplit)..':'..tostring(dirty))
				end
				--            local tp = f.top.cchild ~= nil and f.top.achild[f.top.cchild].shape or f.top.shape -- i < #desc.afloor and 'flat' or md_roof
--                        lo('??********* hU.for_roof:'..i..':'..tostring(f.top.shape)..':'..tostring(forsplit)..' id:'..tostring(f.top.id), true)
				if not f.top.shape then f.top.shape = 'flat' end
				--            local tp = f.top.cchild ~= nil and f.top.achild[f.top.cchild].shape or f.top.shape -- i < #desc.afloor and 'flat' or md_roof
--                        lo('??********* hU.for_roof:'..i..':'..tostring(f.top.shape)..':'..tostring(forsplit)..' id:'..tostring(f.top.id), true)
				if not f.top.shape then f.top.shape = 'flat' end
				--            local tp = f.top.cchild ~= nil and f.top.achild[f.top.cchild].shape or f.top.shape -- i < #desc.afloor and 'flat' or md_roof
--                        lo('??********* hU.for_roof:'..i..':'..tostring(f.top.shape)..':'..tostring(forsplit)..' id:'..tostring(f.top.id), true)
				if not f.top.shape then f.top.shape = 'flat' end

--                    lo('?? post_RA:'..i..':'..tostring(desctop.fat))
				if i == #desc.afloor and desctop.fat and desctop.fat>0 then
					local asi
--                            lo('?? for_GABLE:'..tostring(#f.top.adata))
					local amd = {mdata}
				elseif mdata ~= nil and #mdata.verts > 0 then
--						lo('?? no_child:'..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(f.top.id),true)
					if desctop.uvref then
				elseif mdata ~= nil and #mdata.verts > 0 then
--						lo('?? no_child:'..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(f.top.id),true)
					if desctop.uvref then
				elseif mdata ~= nil and #mdata.verts > 0 then
--						lo('?? no_child:'..tostring(forsplit)..':'..tostring(dirty)..':'..tostring(f.top.id),true)
					if desctop.uvref then
--						local tmat = scenetree.findObject('m_bricks_01_bat')
--						lo('??______________________________________ pre_RENDER:'..#data..':'..#mdatabot.verts) --..tostring(data[2].material)..':'..tostring(tmat)..':'..tostring(tmat.doubleSided)) --..tostring(defmat.doubleSided)..':'..tostring(defmat.obj))
--						U.dump(data, '?? pre_RENDER:'..tostring(defmat.doubleSided),nil,2)
--						local tmat = scenetree.findObject('m_bricks_01_bat')
--						lo('??______________________________________ pre_RENDER:'..#data..':'..#mdatabot.verts) --..tostring(data[2].material)..':'..tostring(tmat)..':'..tostring(tmat.doubleSided)) --..tostring(defmat.doubleSided)..':'..tostring(defmat.obj))
--						U.dump(data, '?? pre_RENDER:'..tostring(defmat.doubleSided),nil,2)
--						local tmat = scenetree.findObject('m_bricks_01_bat')
--						lo('??______________________________________ pre_RENDER:'..#data..':'..#mdatabot.verts) --..tostring(data[2].material)..':'..tostring(tmat)..':'..tostring(tmat.doubleSided)) --..tostring(defmat.doubleSided)..':'..tostring(defmat.obj))
--						U.dump(data, '?? pre_RENDER:'..tostring(defmat.doubleSided),nil,2)
--						local tmat = scenetree.findObject('m_bricks_01_bat')
--						lo('??______________________________________ pre_RENDER:'..#data..':'..#mdatabot.verts) --..tostring(data[2].material)..':'..tostring(tmat)..':'..tostring(tmat.doubleSided)) --..tostring(defmat.doubleSided)..':'..tostring(defmat.obj))
--						U.dump(data, '?? pre_RENDER:'..tostring(defmat.doubleSided),nil,2)
--						local tmat = scenetree.findObject('m_bricks_01_bat')
--						lo('??______________________________________ pre_RENDER:'..#data..':'..#mdatabot.verts) --..tostring(data[2].material)..':'..tostring(tmat)..':'..tostring(tmat.doubleSided)) --..tostring(defmat.doubleSided)..':'..tostring(defmat.obj))
--						U.dump(data, '?? pre_RENDER:'..tostring(defmat.doubleSided),nil,2)
--						lo('??______________________________________ pre_RENDER:'..#data..':'..#mdatabot.verts) --..tostring(data[2].material)..':'..tostring(tmat)..':'..tostring(tmat.doubleSided)) --..tostring(defmat.doubleSided)..':'..tostring(defmat.obj))
--						U.dump(data, '?? pre_RENDER:'..tostring(defmat.doubleSided),nil,2)
					toRender(desctop, data, 'lid')
				local border = scenetree.findObjectById(f.top.border.id)
--                    lo('??+++++++++++++++++++++ if_BORDER:'..tostring(border)..':'..tostring(f.top.border.yes))
				if border then
				local border = scenetree.findObjectById(f.top.border.id)
--                    lo('??+++++++++++++++++++++ if_BORDER:'..tostring(border)..':'..tostring(f.top.border.yes))
				if border then
					lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hU_border:'..i)
--                    U.dump(f.top.border,'??____________ for_BORDER:'..tostring(#f.top.border.shape)..':'..tostring(f.top.shape), true)
					lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hU_border:'..i)
--                    U.dump(f.top.border,'??____________ for_BORDER:'..tostring(#f.top.border.shape)..':'..tostring(f.top.shape), true)
--                            lo('?? for_base:'..i..':'..k)
--                            lo('??++++ ang:'..ang..' w:'..tostring(U.vturn(w,-U.vang(upre,u)/2)),true)
						avert[#avert+1] = base[k] + desc.pos + f.pos + vec3(0,0,forHeight(desc.afloor, f.ij[1]))
					local ang = U.vang(upre,u)/2
--                            lo('??++++ ang:'..ang..' w:'..tostring(U.vturn(w,-U.vang(upre,u)/2)),true)
					avert[#avert+1] = base[k] + desc.pos + f.pos + vec3(0,0,forHeight(desc.afloor, f.ij[1]))
				if wp.list then
--                        U.dump(wp.list, '?? for_AWP:'..i..':'..tostring(dirty))
					for _,list in pairs(wp.list) do
						for key,p in pairs(list) do
--                                lo('?? if_key:'..tostring(key)..':'..tostring(tonumber(key)))
							if tonumber(key) then
						for key,p in pairs(list) do
--                                lo('?? if_key:'..tostring(key)..':'..tostring(tonumber(key)))
							if tonumber(key) then
						uvv = -forHeight(desc.afloor, f.ij[1])*(f.awall[list.ind].uvscale and f.awall[list.ind].uvscale[2] or 1)
--                            U.dump(list, '?? for_list:'.._..':'..tostring(list[1])..':'..tostring(uvv))
						uvv = -forHeight(desc.afloor, f.ij[1])*(f.awall[list.ind].uvscale and f.awall[list.ind].uvscale[2] or 1)
--                            U.dump(list, '?? for_list:'.._..':'..tostring(list[1])..':'..tostring(uvv))
						)
--							U.dump(list, '??^^^^^^^^^^^^^^^^ subroof_AN:'..k..':'.._..':'..#an..':'..tostring(an[1]))
--						an = {f.awall[list.ind].u:cross(f.awall[list.ind].v)}
					if dirty then
--                            lo('?? wp_ID:'..i..':'..tostring(wp.id),true)
						local wallplus = scenetree.findObjectById(wp.id)
						local wallplus = scenetree.findObjectById(wp.id)
		--                    lo('?? for_DIRTY:'..tostring(wallplus)..':'..tostring(f.awplus.id),true)
						if wallplus then
						local wallplus = scenetree.findObjectById(wp.id)
		--                    lo('?? for_DIRTY:'..tostring(wallplus)..':'..tostring(f.awplus.id),true)
						if wallplus then
			local ang = U.vang(u, vec3(1,0,0), true)+math.pi/2
--                U.dump(list[i],'?? toCorner.in_STEM:'..i..tostring(base2world(desc, list[i]))..':'..list[i].dae)
--                lo('??+++++ toC:'..i)
--                lo('??+++++ toC:'..i)
--                lo('?? toCorner:'..tostring(base2world(desc, list[i]))..':'..ang)
			to(desc, list[i].dae,
	local function stem2corner(dae, ij, tot, mlen)
--            U.dump(ij, '>> stem2corner:'..tot..':'..tostring(dae))
--        local nmesh = round(tot/mlen)
		local scale = (tot-0.001)/mlen
--            lo('?? pre_TO: scale:'..tostring(scale)..' mlen:'..mlen) --..' nmesh:'..nmesh..':'..tostring(base2world(desc, ij)))
		to(desc, dae,
		local scale = (tot-0.001)/mlen
--            lo('?? pre_TO: scale:'..tostring(scale)..' mlen:'..mlen) --..' nmesh:'..nmesh..':'..tostring(base2world(desc, ij)))
		to(desc, dae,
			if s and #s.list>0 then
--          U.dump(s.list[1], '?? for_AC:'..i..':'..tostring(s.list)..':'..s.list[1]['1'])
				-- get stem
				-- get stem
--                    U.dump(s.list[1],'??^^^^^^^^^^^^^^^^^^^^^^^^^^^^ for_corner:'..tostring(s.list[1]['1']),true)
				local tot,ci,istart,scale = desc.afloor[s.list[1][1]].h,2,1
	--                    U.dump(s.list, '??+++ while_STEM:'..i..':'..ci,true)
--                        lo('?? in_STEM:'..i..':'..ci..':'..tostring(s.list[ci][1] - s.list[ci-1][1]))
					if s.list[ci][1] - s.list[ci-1][1] == 1 and (not s.list[ci].dae or s.list[ci].dae == s.list[ci-1].dae) then
						scale = tot/(mlen*nmesh)
							lo('?? pre_TO:'..tostring(scale))
						to(desc, s.list[istart].dae,
	--            tot = tot + desc.afloor[s.list[ci-1][1]].h
--                    U.dump(s.list[istart], '?? for_STEM:'..i..':'..ci..'/'..istart..':'..tostring(tot),true)
--                stem2corner(s.list[istart].dae, s.list[istart], tot, mlen)

--        lo('?? HU:'..tostring(forsplit)..':'..tostring(inedit)..':'..#out.avedit..':'..tostring(desctop.roofborder))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(inedit)..':'..tostring(dirty))

--        lo('?? HU:'..tostring(forsplit)..':'..tostring(inedit)..':'..#out.avedit..':'..tostring(desctop.roofborder))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(inedit)..':'..tostring(dirty))

--        lo('?? HU:'..tostring(forsplit)..':'..tostring(inedit)..':'..#out.avedit..':'..tostring(desctop.roofborder))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(inedit)..':'..tostring(dirty))
--        lo('?? HU:'..tostring(forsplit)..':'..tostring(inedit)..':'..#out.avedit..':'..tostring(desctop.roofborder))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(inedit)..':'..tostring(dirty))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(dirty))
--        lo('?? HU:'..tostring(forsplit)..':'..tostring(inedit)..':'..#out.avedit..':'..tostring(desctop.roofborder))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(inedit)..':'..tostring(dirty))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(dirty))
--        lo('?? HU:'..tostring(forsplit)..':'..tostring(inedit)..':'..#out.avedit..':'..tostring(desctop.roofborder))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(inedit)..':'..tostring(dirty))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(dirty))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(inedit)..':'..tostring(dirty))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(dirty))
--------------------------
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(inedit)..':'..tostring(dirty))
--        lo('?? split_edit:'..tostring(forsplit)..':'..tostring(dirty))
--------------------------
--------------------------
--		lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^ hU_prer:'..tostring(desc.id)..':'..tostring(#am)..':'..tostring(desc.data and #desc.data or nil))
	desc.data = am
--------------------------
--		lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^ hU_prer:'..tostring(desc.id)..':'..tostring(#am)..':'..tostring(desc.data and #desc.data or nil))
	desc.data = am
--------------------------
--		lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^ hU_prer:'..tostring(desc.id)..':'..tostring(#am)..':'..tostring(desc.data and #desc.data or nil))
	desc.data = am
	if not forsplit and not dirty then
--		lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^ hU_prer2:'..tostring(#am)..':'..tostring(desc.adata and #desc.adata or nil))
--    if not forsplit and not inedit then
	if not forsplit and not dirty then
--		lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^ hU_prer2:'..tostring(#am)..':'..tostring(desc.adata and #desc.adata or nil))
--    if not forsplit and not inedit then
		if toedit ~= nil then
					lo('??---------- houseUp.EDIT_QUIT:'..tostring(out.lock)..':'..#am)
------------------------
		end
--        lo('<< houseUp:'..#amesh..':'..tostring(amesh[id]))
--    else
	end
--            U.dump(desc.afloor[2].top.achild, '?? post_render333:') --..ic..':'..tostring(c.id),true)
	if out.editkey then
	end
			lo('<<------ houseUp:'..tostring(indrag)..' asave:'..#asave..':'..tostring(cedit.forest))
	return desc
	end
			lo('<<------ houseUp:'..tostring(indrag)..' asave:'..#asave..':'..tostring(cedit.forest))
	return desc
	return desc
--            lo('?? HU3:'..':'..tostring(cedit.forest))
--            U.dump(out.avedit, '<< houseUp:')
		for k,c in pairs(adesc[desc.prn].afloor[desc.floor-1].achild) do
--                    lo('?? for_child:'..k..':'..tostring(c.id))
			if c.id == cedit.mesh then
	end
		lo('??******^^^^^^^^^ houseDown:'..tostring(fkeep)..':'..#adf)
	local id = desc.id or cedit.mesh
	local id = desc.id or cedit.mesh
		lo('?? hD.DEL_building:'..tostring(cedit.mesh)..':'..tostring(desc.id))
	scenetree.findObject('edit'):deleteAllObjects()
	local id = desc.id or cedit.mesh
		lo('?? hD.DEL_building:'..tostring(cedit.mesh)..':'..tostring(desc.id))
	scenetree.findObject('edit'):deleteAllObjects()
		end
			lo('?? undo.restored:'..tostring(cedit.mesh)..':'..tostring(cij))
		markUp()
		end
			lo('?? undo.restored:'..tostring(cedit.mesh)..':'..tostring(cij))
		markUp()
W.building4test = function(num, R, center, istemplate)
		lo('>> building4test:'..R..':'..tostring(center))
--		if true then return end
	local list = FS:findFiles(pth, '*.dae', -1, true, false)
		lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ building4test:'..tostring(pth)..':'..tableSize(amesh))
	for i,s in pairs(list) do
	list = FS:findFiles(pth, '*.json', -1, true, false)
--		lo('?? onVal_gen_unique:'..tostring(pth)..':'..tableSize(amesh))
	for i,s in pairs(list) do
	-- generate
		lo('?? to_GEN:'..num..':'..tostring(L)..':'..tostring(tb))
	local ashape = {'l_shape',
	-- generate
		lo('?? to_GEN:'..num..':'..tostring(L)..':'..tostring(tb))
	local ashape = {'l_shape',
		end
			lo('?? for_BASE:'..i..':'..tableSize(base)..':'..tostring(p))
		W.buildingGen(p, base, true)
--    local ingen = (base and not intest) and true or false
		lo('>> buildingGen:'..tostring(p)..':'..tostring(base)..':'..tostring(ingen)..':'..tostring(intest))
	if false then
--    local ingen = (base and not intest) and true or false
		lo('>> buildingGen:'..tostring(p)..':'..tostring(base)..':'..tostring(ingen)..':'..tostring(intest))
	if false then
--    local ingen = (base and not intest) and true or false
		lo('>> buildingGen:'..tostring(p)..':'..tostring(base)..':'..tostring(ingen)..':'..tostring(intest))
	if false then
--    local ingen = (base and not intest) and true or false
		lo('>> buildingGen:'..tostring(p)..':'..tostring(base)..':'..tostring(ingen)..':'..tostring(intest))
	if false then
		end
			lo('?? fj1:'..tostring(desc.pos)..':'..tostring(desc.id))
	--        U.dump(desc.pos, '?? fj1:'..tostring(desc.pos))
		end
			lo('?? fj1:'..tostring(desc.pos)..':'..tostring(desc.id))
	--        U.dump(desc.pos, '?? fj1:'..tostring(desc.pos))
			lo('?? fj1:'..tostring(desc.pos)..':'..tostring(desc.id))
	--        U.dump(desc.pos, '?? fj1:'..tostring(desc.pos))
		houseUp(desc)
--    local awmat = {'m_bricks_01', 'metal_plates', 'm_stonebrick_eroded_01'} --'m_stonebrick_mixed_02'} --, 'm_stonebricks_mixed_01', 'm_stonebricks_mixed_01'}
--		lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^ BG_mat:'..tostring(out.inseed)..':'..tableSize(W.ui.mat_wall)..':'..tostring(W.ui.building_style)..':'..#dmat.wall)
	if out.inseed then
--    local awmat = {'m_bricks_01', 'metal_plates', 'm_stonebrick_eroded_01'} --'m_stonebrick_mixed_02'} --, 'm_stonebricks_mixed_01', 'm_stonebricks_mixed_01'}
--		lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^ BG_mat:'..tostring(out.inseed)..':'..tableSize(W.ui.mat_wall)..':'..tostring(W.ui.building_style)..':'..#dmat.wall)
	if out.inseed then
	if out.inseed then
			lo('?? for_shape:'..tostring(W.ui.building_shape))
--        U.dump(W.ui.mat_wall, '??___________ GEN_mat:')
	end
--		U.dump(dmat.roof, '?? mats_ROOF:'..tostring(mat))
	mat = tostring(mat)
--		U.dump(dmat.roof, '?? mats_ROOF:'..tostring(mat))
	mat = tostring(mat)
--		lo('?? roof_MAT:'..mat..':'..tostring(#dmat.roof)..':'..tostring(ingen))
	mat = tostring(mat)
--		lo('?? roof_MAT:'..mat..':'..tostring(#dmat.roof)..':'..tostring(ingen))
	mat = tostring(mat)
--		lo('?? roof_MAT:'..mat..':'..tostring(#dmat.roof)..':'..tostring(ingen))

	local wmat = (intest or ingen or out.inseed) and tostring(awmat[math.random(1, #awmat)]) or out.defmat -- 'm_greybox_base'
	if U._PRD == 0 and not intest then
--                awall[#awall].df[awall[#awall].win] = {}
--                lo('?? for_dorr:'..tostring(awall[#awall].door))
--                awall[#awall].df[awall[#awall].door] = {}
--        for key,b in pairs(adesc) do
--            U.dump(adesc[key].afloor[1].base, '<< buildingGen:'..key..':'..tostring(adesc[key].pos))
--        end
--        lo('<<'..cedit.mesh)
--        U.dump(adesc[cedit.mesh].afloor[1].base, '<< buildingGen:'..tostring(adesc[cedit.mesh].pos))
end
W.buildingScan = function(desc, ondone)
		lo('?? buildingScan:'..tostring(desc))
	local ascan = {}
			--dir = U.vturn(dir, math.pi/2)
--					lo('?? for_DIR:'..tostring(wall.u)..':'..tostring(wall.v)..':'..tostring(dir))
			local q = quatFromDir(dir, vec3(0,0,1))
			--dir = U.vturn(dir, math.pi/2)
--					lo('?? for_DIR:'..tostring(wall.u)..':'..tostring(wall.v)..':'..tostring(dir))
			local q = quatFromDir(dir, vec3(0,0,1))
			--dir = U.vturn(dir, math.pi/2)
--					lo('?? for_DIR:'..tostring(wall.u)..':'..tostring(wall.v)..':'..tostring(dir))
			local q = quatFromDir(dir, vec3(0,0,1))
			ascan[#ascan+1] = fname
				lo('?? for_RV3:'..fname..':'..tostring(renderView))
			RenderViewManagerInstance:destroyView(renderView)
	local geomain = M.forNode(xmain, {'COLLADA','library_geometries','geometry'})
--				lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
--				lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
	local geomain = M.forNode(xmain, {'COLLADA','library_geometries','geometry'})
--				lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
--				lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
--				lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
--				lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
	---- append lod as geometry
--				lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
--				lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
	---- append lod as geometry
--				lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
--				lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
	---- append lod as geometry
	local nd_maingeo = nodevs.kids[2]
		lo('??^^^^^^^^^^ if_KIDS:'..tableSize(nodevs.kids)..':'..tostring(nd_maingeo.attr['id'])) --..tostring(nd_maingeo.kids[2].name)) --..tostring(tableSize(nd_maingeo.kids[2])))
	nodevs = M.forNode(xmain, {'COLLADA','library_visual_scenes'})
	local nd_maingeo = nodevs.kids[2]
		lo('??^^^^^^^^^^ if_KIDS:'..tableSize(nodevs.kids)..':'..tostring(nd_maingeo.attr['id'])) --..tostring(nd_maingeo.kids[2].name)) --..tostring(tableSize(nd_maingeo.kids[2])))
	nodevs = M.forNode(xmain, {'COLLADA','library_visual_scenes'})
	local nd_maingeo = nodevs.kids[2]
		lo('??^^^^^^^^^^ if_KIDS:'..tableSize(nodevs.kids)..':'..tostring(nd_maingeo.attr['id'])) --..tostring(nd_maingeo.kids[2].name)) --..tostring(tableSize(nd_maingeo.kids[2])))
	nodevs = M.forNode(xmain, {'COLLADA','library_visual_scenes'})
--    local lid = desctop
--        lo('?? forRoof:'..tostring(#desctop.achild))
	if desctop.achild and #desctop.achild > 0 then
--        _dbdrag = true
--        lo('?? matMove:'..tostring(ds)..':'..tostring(indrag)..':'..tostring(scope), true)
	if scope == 'top' then
--        _dbdrag = true
--        lo('?? matMove:'..tostring(ds)..':'..tostring(indrag)..':'..tostring(scope), true)
	if scope == 'top' then
--        _dbdrag = true
--        lo('?? matMove:'..tostring(ds)..':'..tostring(indrag)..':'..tostring(scope), true)
	if scope == 'top' then
--            if true then return end
--            lo('?? for_DS:'..tostring(ds), true)
		local floor = adesc[cedit.mesh].afloor[cij[1]]
			if not id then return end
--                lo('?? mmove_topid:'..tostring(id))
			mesh = aedit[id].mesh
--            U.dump(mesh, '?? for_MESH_top:')
			lo('?? for_DM:'..tostring(cedit.cval['DragMat'])..':'..tostring(isrel),true)
		if not cedit.cval['DragMat'] then
--            U.dump(mesh, '?? for_MESH_top:')
			lo('?? for_DM:'..tostring(cedit.cval['DragMat'])..':'..tostring(isrel),true)
		if not cedit.cval['DragMat'] then
		if isrel then
--                U.dump(cedit.cval['DragMat'], '?? uv_ROOF:'..tostring(ds)..':'..tostring(floor.top.achild))
			local n = 1
		if isrel then
--                U.dump(cedit.cval['DragMat'], '?? uv_ROOF:'..tostring(ds)..':'..tostring(floor.top.achild))
			local n = 1
			W.forRoof(floor.top, function(c)
					lo('?? for_lid:'..n..':'..tostring(ds),true)
				c.uvref = {cedit.cval['DragMat'][n][1][1]+ds.x, cedit.cval['DragMat'][n][1][2]+ds.y}

--        lo('?? MM:'..tostring(u),true)
	forBuilding(adesc[cedit.mesh], function(w, ij)
		for _,xy in pairs(w.agrid) do
--                lo('?? for_XY1:'..tostring(xy[1])..':'..tostring(xy[2]), true)
--                U.dump(xy[1], '?? for_XY1:')
		for _,xy in pairs(w.agrid) do
--                lo('?? for_XY1:'..tostring(xy[1])..':'..tostring(xy[2]), true)
--                U.dump(xy[1], '?? for_XY1:')
		end
--            lo('?? uv_MOVE:'..tostring(cds)..':'..tostring(cds:dot(u))..':'..tostring(suvs[1].u - cds:dot(u))..':'..tostring(suvs[1].v - cds:dot(v)))
--            lo('?? duvs:'..ij[1]..':'..ij[2]..' suvs:'..#suvs..' verts:'..#mesh.verts)
		end
--            lo('?? uv_MOVE:'..tostring(cds)..':'..tostring(cds:dot(u))..':'..tostring(suvs[1].u - cds:dot(u))..':'..tostring(suvs[1].v - cds:dot(v)))
--            lo('?? duvs:'..ij[1]..':'..ij[2]..' suvs:'..#suvs..' verts:'..#mesh.verts)
		end
--            lo('?? uv_MOVE:'..tostring(cds)..':'..tostring(cds:dot(u))..':'..tostring(suvs[1].u - cds:dot(u))..':'..tostring(suvs[1].v - cds:dot(v)))
--            lo('?? duvs:'..ij[1]..':'..ij[2]..' suvs:'..#suvs..' verts:'..#mesh.verts)
		end
--            lo('?? uv_MOVE:'..tostring(cds)..':'..tostring(cds:dot(u))..':'..tostring(suvs[1].u - cds:dot(u))..':'..tostring(suvs[1].v - cds:dot(v)))
--            lo('?? duvs:'..ij[1]..':'..ij[2]..' suvs:'..#suvs..' verts:'..#mesh.verts)
end
--            lo('?? u'..tostring(w.u),true)
--            U.dump(w.agrid, '?? AGRID:')
	local n = 1
--        U.dump(cedit.cval['DragMat'], '?? matScale:'..tostring(scale[1])..':'..tostring(scale[2]))
	if scope == 'top' then
	local n = 1
--        U.dump(cedit.cval['DragMat'], '?? matScale:'..tostring(scale[1])..':'..tostring(scale[2]))
	if scope == 'top' then
--    indrag = true
--        lo('>> matMove:'..tostring(v)..':'..idobj)
--        U.dump(aedit[idobj].desc, '?? desc:')
			local ang = U.vang(u1,u2) % (math.pi/2)
--                lo('?? for_ang:'..ij[1]..':'..ij[2]..':'..ang..':'..tostring(dae), true)
			if not (math.abs(ang) < small_ang or math.abs(1-ang) < small_ang) then
	dae = daePath[tp][ind+1]
		lo('>> meshApply:'..tp..':'..#daePath[tp]..' ind:'..tostring(ind)..':'..tostring(cedit.forest)..':'..tostring(cedit.fscope)..':'..tostring(out.inhole)..':'..tostring(dae), true)
--		lo('?? for_DAE:'..dae)
	dae = daePath[tp][ind+1]
		lo('>> meshApply:'..tp..':'..#daePath[tp]..' ind:'..tostring(ind)..':'..tostring(cedit.forest)..':'..tostring(cedit.fscope)..':'..tostring(out.inhole)..':'..tostring(dae), true)
--		lo('?? for_DAE:'..dae)
	dae = daePath[tp][ind+1]
		lo('>> meshApply:'..tp..':'..#daePath[tp]..' ind:'..tostring(ind)..':'..tostring(cedit.forest)..':'..tostring(cedit.fscope)..':'..tostring(out.inhole)..':'..tostring(dae), true)
--		lo('?? for_DAE:'..dae)
	dae = daePath[tp][ind+1]
		lo('>> meshApply:'..tp..':'..#daePath[tp]..' ind:'..tostring(ind)..':'..tostring(cedit.forest)..':'..tostring(cedit.fscope)..':'..tostring(out.inhole)..':'..tostring(dae), true)
--		lo('?? for_DAE:'..dae)
	dae = daePath[tp][ind+1]
		lo('>> meshApply:'..tp..':'..#daePath[tp]..' ind:'..tostring(ind)..':'..tostring(cedit.forest)..':'..tostring(cedit.fscope)..':'..tostring(out.inhole)..':'..tostring(dae), true)
--		lo('?? for_DAE:'..dae)
--		dae = daePath[tp][ind]
--                U.dump(out.inhole.achild, '?? achild:'..tostring(tp)..':'..child.body..':'..dae)
		child.body = dae
				local s = adesc[cedit.mesh].aspline[ij[1]][ij[2]]
					lo('?? f_SPLINE:'..ij[2]..':'..tostring(s))
				for _,d in pairs(s.aforest) do
		dae = daePath[tp][ind+1]
--            U.dump(cij, '?? meshApply:'..tp..':'..ind..':'..tostring(cedit.forest-1)..':'..tostring(dae))
		desc = adesc[cedit.mesh]
		dae = daePath[tp][ind+1]
--            U.dump(cij, '?? meshApply:'..tp..':'..ind..':'..tostring(cedit.forest-1)..':'..tostring(dae))
		desc = adesc[cedit.mesh]
--			desc = adesc[cedit.mesh]
--                U.dump(desc.acorner,'?? for_CORNER:'..tostring(desc.df)..':'..tostring(cedit.forest))
--                lo('?? ifforr11:'..tostring(iforest))
--			desc = adesc[cedit.mesh]
--                U.dump(desc.acorner,'?? for_CORNER:'..tostring(desc.df)..':'..tostring(cedit.forest))
--                lo('?? ifforr11:'..tostring(iforest))
--                U.dump(desc.acorner,'?? for_CORNER:'..tostring(desc.df)..':'..tostring(cedit.forest))
--                lo('?? ifforr11:'..tostring(iforest))
--            desc.acorner = cornersBuild(desc, ind)
		--        U.dump(w.df, '?? for wall:'..ij[1]..':'..ij[2]..':'..cedit.forest)
		--        U.dump(w.df, '??_+__ DF:'..cedit.forest..':'..tostring(cedit.forest == w.df[dae]))
				if iforest then return end
					iforest = true --U.index(w.df[d], cedit.forest)[1]
--						lo('??************* mA.for_SPLINE:'..ij[2]..':'..tostring(iforest))
					forspline = desc.aspline[ij[1]][ij[2]]
			end, nil, true)
--                lo('?? iforest2:'..tostring(iforest),true)
			if forspline then
			if not iforest then
				lo('!! ERR_NO_FOREST_INDEX:'..tostring(cedit.forest)..':'..tostring(dae))
				return
			if not iforest then
				lo('!! ERR_NO_FOREST_INDEX:'..tostring(cedit.forest)..':'..tostring(dae))
				return
				if tp == 'storefront' then
--                        U.dump(w, '?? for_SF:'..tostring(cedit.forest)..':'..tostring(tp),true)
					local daepre = U.forOrig(dforest[cedit.forest].item:getData():getShapeFile())
				if tp == 'storefront' then
--                        U.dump(w, '?? for_SF:'..tostring(cedit.forest)..':'..tostring(tp),true)
					local daepre = U.forOrig(dforest[cedit.forest].item:getData():getShapeFile())
					local daepre = U.forOrig(dforest[cedit.forest].item:getData():getShapeFile())
--                        lo('?? dae_PRE:'..tostring(daepre)..':'..iforest)
					local ind = U.index(w[tp].adae, daepre)[iforest]
				elseif ({win=1,door=1})[tp] then
--            U.dump(w.df,'?? mA_wd:'..ij[1]..':'..ij[2]..':'..tostring(cedit.fscope)..':'..tostring(cedit.mesh))
--                else
				elseif ({win=1,door=1})[tp] then
--            U.dump(w.df,'?? mA_wd:'..ij[1]..':'..ij[2]..':'..tostring(cedit.fscope)..':'..tostring(cedit.mesh))
--                else
--                else
	              		lo('?? meshApply:'..tostring(cedit.fscope),true)
					if cedit.fscope == 1 then
						if tp == 'door' then
							lo('?? for_DAE:'..w[tp]..':'..tostring(w.doorind))
						w.doorwidth = ddae[w[tp]].to.x - ddae[w[tp]].fr.x + 0.2
							-- adjust basement height
			--                                U.dump(w.doorstairs[w.doorind],'?? for_stairs:'..tostring(w.doorstairs[w.doorind]))
							adesc[cedit.mesh].afloor[1].h = math.abs(ddae[w.doorstairs[w.doorind].dae].fr.z) + ddae[dae].fr.z
									end
					--                                    U.dump(ddae[dae], '??^^^^^^^^^^^^^^^^ meshApply2:'..tp..':'..tostring(dae))
									if dae then
		end
--			lo('?? iforest:'..tostring(iforest)..':'..tostring(cij[1])..':'..tostring(cij[2])) --..':'..dae)
		if tp == 'roofborder' then
		end
--			lo('?? iforest:'..tostring(iforest)..':'..tostring(cij[1])..':'..tostring(cij[2])) --..':'..dae)
		if tp == 'roofborder' then
		end
--			lo('?? iforest:'..tostring(iforest)..':'..tostring(cij[1])..':'..tostring(cij[2])) --..':'..dae)
		if tp == 'roofborder' then
	houseUp(adesc[cedit.mesh], cedit.mesh, true)
--       U.dump(adesc[cedit.mesh].afloor[cij[1]].awall[cij[2]].df,'?? after_HU:'..tostring(cedit.forest)..' ifor:'..iforest)
--        lo('?? iff333:'..tostring(iforest)..':'..tostring(tp))
--       U.dump(adesc[cedit.mesh].afloor[cij[1]].awall[cij[2]].df,'?? after_HU:'..tostring(cedit.forest)..' ifor:'..iforest)
--        lo('?? iff333:'..tostring(iforest)..':'..tostring(tp))
	if tp == 'corner' then
--       U.dump(adesc[cedit.mesh].afloor[cij[1]].awall[cij[2]].df,'?? after_HU:'..tostring(cedit.forest)..' ifor:'..iforest)
--        lo('?? iff333:'..tostring(iforest)..':'..tostring(tp))
	if tp == 'corner' then
		if not cij[2] then cij[2] = 1 end
--			U.dump(cij, '??___^^^**** if_MESH:'..tostring(cedit.mesh))
		if adesc[cedit.mesh].afloor[cij[1]].awall[cij[2]].df[dae] then
		else
			lo('!! ERR_NO_DF_DAE:'..tostring(dae),true)
		end
	end
		lo('?? if_DAE:'..tostring(dae))
	markUp(dae, tp == 'roofborder' and tp or nil)
--        U.dump(adesc[cedit.mesh].df, '?? for_DF:')
--        lo('<< meshApply:'..ind..':'..tostring(cedit.forest)..':'..tostring(out.inhole)..':'..tostring(W.ifForest()), true) -- tostring(dforest[cedit.forest].item))
--        W.ui.dbg = true
--        U.dump(adesc[cedit.mesh].df, '?? for_DF:')
--        lo('<< meshApply:'..ind..':'..tostring(cedit.forest)..':'..tostring(out.inhole)..':'..tostring(W.ifForest()), true) -- tostring(dforest[cedit.forest].item))
--        W.ui.dbg = true
--        U.dump(adesc[cedit.mesh].df, '?? for_DF:')
--        lo('<< meshApply:'..ind..':'..tostring(cedit.forest)..':'..tostring(out.inhole)..':'..tostring(W.ifForest()), true) -- tostring(dforest[cedit.forest].item))
--        W.ui.dbg = true
--        U.dump(adesc[cedit.mesh].df, '?? for_DF:')
--        lo('<< meshApply:'..ind..':'..tostring(cedit.forest)..':'..tostring(out.inhole)..':'..tostring(W.ifForest()), true) -- tostring(dforest[cedit.forest].item))
--        W.ui.dbg = true
local function matApply(nm, ind)
		lo('>> matApply:'..tostring(nm)..':'..tostring(ind)) --..':'..cedit.forest) --..':'..ind..':'..tostring(cmesh))
--    if not nm then return end
local function matApply(nm, ind)
		lo('>> matApply:'..tostring(nm)..':'..tostring(ind)) --..':'..cedit.forest) --..':'..ind..':'..tostring(cmesh))
--    if not nm then return end
local function matApply(nm, ind)
		lo('>> matApply:'..tostring(nm)..':'..tostring(ind)) --..':'..cedit.forest) --..':'..ind..':'..tostring(cmesh))
--    if not nm then return end
	if #U.index(dmat.wall,nm) == 0 then
		lo('!! NO_MAT:'..tostring(nm))
		return
	local desc = adesc[cedit.mesh]
--		U.dump(desc.aspline, '?? if_SEL:'..tostring(desc.selection and tableSize(desc.selection) or nil))
	if desc and desc.selection then
				if not tonumber(key) and desc.aspline[i][key] then
						lo('??^^^^^^^^^^^^^^^^ for22_SPLINE:'..i..':'..key..':'.._..':'..tostring(cedit.mesh))
					desc.aspline[i][key].mat = nm
		end
--            U.dump(dmesh[cmesh].sel, '?? matApply_for_mesh:'..tostring(#dmesh[cmesh].sel))
		return
	end
--		lo('>>+++++++ matApply:'..tostring(nm)..':'..tostring(scope)..':'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(cedit.forest), true) --..':'..#desc.afloor)
--    if cedit.forest ~= nil then return end
	end
--		lo('>>+++++++ matApply:'..tostring(nm)..':'..tostring(scope)..':'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(cedit.forest), true) --..':'..#desc.afloor)
--    if cedit.forest ~= nil then return end
	end
--		lo('>>+++++++ matApply:'..tostring(nm)..':'..tostring(scope)..':'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(cedit.forest), true) --..':'..#desc.afloor)
--    if cedit.forest ~= nil then return end
	end
--		lo('>>+++++++ matApply:'..tostring(nm)..':'..tostring(scope)..':'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(cedit.forest), true) --..':'..#desc.afloor)
--    if cedit.forest ~= nil then return end
	end
--		lo('>>+++++++ matApply:'..tostring(nm)..':'..tostring(scope)..':'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(cedit.forest), true) --..':'..#desc.afloor)
--    if cedit.forest ~= nil then return end
		local currentMaterial = scenetree.findObject(nm)
			lo('?? if_CHANNELS:'..tostring(currentMaterial.activeLayers)..':'..tostring(currentMaterial.normalMap)..':'..tostring(currentMaterial.normalMapUseUV))
		currentMaterial.normalMapUseUV = 1
		local currentMaterial = scenetree.findObject(nm)
			lo('?? if_CHANNELS:'..tostring(currentMaterial.activeLayers)..':'..tostring(currentMaterial.normalMap)..':'..tostring(currentMaterial.normalMapUseUV))
		currentMaterial.normalMapUseUV = 1
		local currentMaterial = scenetree.findObject(nm)
			lo('?? if_CHANNELS:'..tostring(currentMaterial.activeLayers)..':'..tostring(currentMaterial.normalMap)..':'..tostring(currentMaterial.normalMapUseUV))
		currentMaterial.normalMapUseUV = 1
			for k,v in pairs(info) do
--                lo('?? KV:'..tostring(k)..':'..tostring(v))
			end
			for k,v in pairs(info) do
--                lo('?? KV:'..tostring(k)..':'..tostring(v))
			end
			end
			lo('?? for_ID:'..tostring(desc.afloor[2].awall[2].id))
			local wo = scenetree.findObjectById(desc.afloor[2].awall[2].id)
--            U.dump(desc.afloor[2].awall[2],'?? DONE:')
--            U.dump(info, '?? for_INF:'..tostring(info))
--            lo(''..tostring(currentMaterial:getField("normalMap", 0)))
--            U.dump(info, '?? for_INF:'..tostring(info))
--            lo(''..tostring(currentMaterial:getField("normalMap", 0)))
--            U.dump(currentMaterial.normalMap, '?? for_NM:')
		local floor = desc.afloor[cij[1]]
--            lo('?? for_roof:'..tostring(cedit.part)..':'..cij[1]..':'..tostring(floor.top.cchild)..'/'..#floor.top.achild)
		local desctop
		local floor = desc.afloor[cij[1]]
--            lo('?? for_roof:'..tostring(cedit.part)..':'..cij[1]..':'..tostring(floor.top.cchild)..'/'..#floor.top.achild)
		local desctop
			w.update = true
			lo('?? in_aedit:'..tostring(aedit[w.id].desc.mat))
		end
local function scopeOn(s)
		lo('>> scopeOn:'..tostring(s)..':'..tostring(cedit.forest))
	out.inroad = nil
local function scopeOn(s)
		lo('>> scopeOn:'..tostring(s)..':'..tostring(cedit.forest))
	out.inroad = nil
		for i,m in pairs(dmat.roof) do
--                lo('?? for_mat:'..tostring(m))
			if tostring(m) == mat then
--                lo('?? for_mat:'..tostring(m))
			if tostring(m) == mat then
				out.curselect = i-1
			end
				lo('?? scopeOn_top:'..tostring(top.ismult))
			top.isridge = T.forRidge(adesc[cedit.mesh].afloor[cij[1]],base,nil,nil,true)
						pos = U.proj2D(desc.afloor[i].pos + desc.afloor[i].awall[n].pos)
	--                        lo('?? w_pos:'..tostring(desc.afloor[i].awall[n].pos))
					else
					else
						lo('?? if_DOOR:'..i..':'..n..':'..tostring(desc.afloor[i].awall[n].doorind))
						if math.abs(len - desc.afloor[i].awall[n].u:length()) > small_dist then

--        lo('?? scopeOn.part'..tostring(cedit.part)..':'..tostring(adesc[cedit.mesh].afloor[#adesc[cedit.mesh].afloor].top.id))
--        cedit.part = adesc[cedit.mesh].afloor[#adesc[cedit.mesh].afloor].top.id

--        lo('?? scopeOn.part'..tostring(cedit.part)..':'..tostring(adesc[cedit.mesh].afloor[#adesc[cedit.mesh].afloor].top.id))
--        cedit.part = adesc[cedit.mesh].afloor[#adesc[cedit.mesh].afloor].top.id
				imat = U.index(dmat.roof, dae)[1]
		--            U.dump(dmat.roof, '?? mroof:'..tostring(dae)..':'..tostring(imat))
			end
				imat = U.index(dmat.roof, dae)[1]
		--            U.dump(dmat.roof, '?? mroof:'..tostring(dae)..':'..tostring(imat))
			end
		elseif cij[2] then
				lo('?? for_cij:'..tostring(cij[1])..':'..tostring(cij[2]))
			dae = adesc[cedit.mesh].afloor[cij[1]].awall[cij[2]].mat
		elseif cij[2] then
				lo('?? for_cij:'..tostring(cij[1])..':'..tostring(cij[2]))
			dae = adesc[cedit.mesh].afloor[cij[1]].awall[cij[2]].mat
		end
	--      U.dump(cij, '?? sO:'..tostring(dae)..':'..tostring(scope)..':'..tostring(imat))
	--    out.curselect = daeIndex('door', dae)
		end
	--      U.dump(cij, '?? sO:'..tostring(dae)..':'..tostring(scope)..':'..tostring(imat))
	--    out.curselect = daeIndex('door', dae)
		end
	--      U.dump(cij, '?? sO:'..tostring(dae)..':'..tostring(scope)..':'..tostring(imat))
	--    out.curselect = daeIndex('door', dae)
	markUp()
		lo('<< scopeOn:'..tostring(out.curselect)..':'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--            U.dump(aedit[cpart].desc.ij, '?? scopeOn_ij:')
	markUp()
		lo('<< scopeOn:'..tostring(out.curselect)..':'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--            U.dump(aedit[cpart].desc.ij, '?? scopeOn_ij:')
	markUp()
		lo('<< scopeOn:'..tostring(out.curselect)..':'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--            U.dump(aedit[cpart].desc.ij, '?? scopeOn_ij:')
local function selectionHide()
		lo('?? selectionHide:'..tostring(scope)..':'..tostring(cedit.forest))
			out.ccommand = ''
local function selectionHide()
		lo('?? selectionHide:'..tostring(scope)..':'..tostring(cedit.forest))
			out.ccommand = ''
		local s = W.forSpline()
			lo('?? hide_AFOREST:'..#cedit.aforest..':'..tostring(s))
		for i,d in pairs(s.aforest) do
	cij = U.clone(aedit[id].desc.ij)
		U.dump(cij, '>> partOn:'..tostring(id)..':'..tostring(aedit[id]))
	cij = U.clone(aedit[id].desc.ij)
		U.dump(cij, '>> partOn:'..tostring(id)..':'..tostring(aedit[id]))

--            lo('>> partOn:'..tostring(id)..' i:'..tostring(cij[1]))
--            U.dump(aedit[id].desc, '?? DESC:')

--            lo('>> partOn:'..tostring(id)..' i:'..tostring(cij[1]))
--            U.dump(aedit[id].desc, '?? DESC:')
local function objEditStop()
	lo('>> objEditStop:'..tostring(cedit.mesh))
	scenetree.findObject('edit'):deleteAllObjects()
	scenetree.findObject('edit'):deleteAllObjects()
--    lo('?? for_edit:'..tostring(cedit.mesh))
	if cedit.mesh ~=nil then
--    scenetree.findObject('edit'):deleteAllObjects()
--        U.dump(dforest, '?? forestEdit:'..tostring(key))
	local meshid = dforest[key] and dforest[key].mesh or nil
	local desc = adesc[meshid]
			lo('>> forestEdit:'..key..':'..tostring(dforest[key].type)..':'..tostring(meshid)..':'..tostring(desc)) --..':'..tostring(dforest[key])..':'..tostring(dforest[key].item))
--    cij = nil
	local desc = adesc[meshid]
			lo('>> forestEdit:'..key..':'..tostring(dforest[key].type)..':'..tostring(meshid)..':'..tostring(desc)) --..':'..tostring(dforest[key])..':'..tostring(dforest[key].item))
--    cij = nil
	local desc = adesc[meshid]
			lo('>> forestEdit:'..key..':'..tostring(dforest[key].type)..':'..tostring(meshid)..':'..tostring(desc)) --..':'..tostring(dforest[key])..':'..tostring(dforest[key].item))
--    cij = nil
	local desc = adesc[meshid]
			lo('>> forestEdit:'..key..':'..tostring(dforest[key].type)..':'..tostring(meshid)..':'..tostring(desc)) --..':'..tostring(dforest[key])..':'..tostring(dforest[key].item))
--    cij = nil
	local desc = adesc[meshid]
			lo('>> forestEdit:'..key..':'..tostring(dforest[key].type)..':'..tostring(meshid)..':'..tostring(desc)) --..':'..tostring(dforest[key])..':'..tostring(dforest[key].item))
--    cij = nil
	local base = floor.base
			lo('?? ifchild:'..tostring(floor.top.cchild)..':'..tostring(#floor.top.achild))
	local mat = floor.top.mat
	local base = floor.base
			lo('?? ifchild:'..tostring(floor.top.cchild)..':'..tostring(#floor.top.achild))
	local mat = floor.top.mat
		base = c.base
--            U.dump(floor.top.achild, '?? for_ACHILD:'..tostring(floor.top.cchild)..':'..tostring(#floor.top.achild))
		mat = c.mat
		base = c.base
--            U.dump(floor.top.achild, '?? for_ACHILD:'..tostring(floor.top.cchild)..':'..tostring(#floor.top.achild))
		mat = c.mat
  end
		lo('??******************************************************** POST_split:'..floor.top.cchild..'/'..#floor.top.achild..':'..tostring(fat))
--            U.dump(floor.top.achild, '??************************************************************* achild:'..#floor.top.achild)
		local conc = (base[(j + 0) % #base + 1] - base[(j - 1) % #base + 1]):cross(base[(j - 1) % #base + 1] - base[(j - 2) % #base + 1]).z
--        lo('?? for_dist:'..j..':'..conc) --..p:distanceToLine(aint[1][1], aint[2][1])) --..tostring(aint[1])..':'..tostring(aint[2])..':'..tostring(p)..':'..(aint[1] - p):length()..':'..(aint[2] - p):length())
--            lo('?? if_CLOSE:'..j..':'..tostring(p)..':'..tostring(aint[1][1])..':'..tostring(aint[2][1]))
		local conc = (base[(j + 0) % #base + 1] - base[(j - 1) % #base + 1]):cross(base[(j - 1) % #base + 1] - base[(j - 2) % #base + 1]).z
--        lo('?? for_dist:'..j..':'..conc) --..p:distanceToLine(aint[1][1], aint[2][1])) --..tostring(aint[1])..':'..tostring(aint[2])..':'..tostring(p)..':'..(aint[1] - p):length()..':'..(aint[2] - p):length())
--            lo('?? if_CLOSE:'..j..':'..tostring(p)..':'..tostring(aint[1][1])..':'..tostring(aint[2][1]))
		local conc = (base[(j + 0) % #base + 1] - base[(j - 1) % #base + 1]):cross(base[(j - 1) % #base + 1] - base[(j - 2) % #base + 1]).z
--        lo('?? for_dist:'..j..':'..conc) --..p:distanceToLine(aint[1][1], aint[2][1])) --..tostring(aint[1])..':'..tostring(aint[2])..':'..tostring(p)..':'..(aint[1] - p):length()..':'..(aint[2] - p):length())
--            lo('?? if_CLOSE:'..j..':'..tostring(p)..':'..tostring(aint[1][1])..':'..tostring(aint[2][1]))
--        lo('?? for_dist:'..j..':'..conc) --..p:distanceToLine(aint[1][1], aint[2][1])) --..tostring(aint[1])..':'..tostring(aint[2])..':'..tostring(p)..':'..(aint[1] - p):length()..':'..(aint[2] - p):length())
--            lo('?? if_CLOSE:'..j..':'..tostring(p)..':'..tostring(aint[1][1])..':'..tostring(aint[2][1]))
		if p:distanceToLineSegment(aint[1][1], aint[2][1]) < rmatch then
--        lo('?? for_dist:'..j..':'..conc) --..p:distanceToLine(aint[1][1], aint[2][1])) --..tostring(aint[1])..':'..tostring(aint[2])..':'..tostring(p)..':'..(aint[1] - p):length()..':'..(aint[2] - p):length())
--            lo('?? if_CLOSE:'..j..':'..tostring(p)..':'..tostring(aint[1][1])..':'..tostring(aint[2][1]))
		if p:distanceToLineSegment(aint[1][1], aint[2][1]) < rmatch then
--        lo('?? for_dist:'..j..':'..conc) --..p:distanceToLine(aint[1][1], aint[2][1])) --..tostring(aint[1])..':'..tostring(aint[2])..':'..tostring(p)..':'..(aint[1] - p):length()..':'..(aint[2] - p):length())
--            lo('?? if_CLOSE:'..j..':'..tostring(p)..':'..tostring(aint[1][1])..':'..tostring(aint[2][1]))
		if p:distanceToLineSegment(aint[1][1], aint[2][1]) < rmatch then
		if p:distanceToLineSegment(aint[1][1], aint[2][1]) < rmatch then
--            lo('?? for_dist:'..j..':'..tostring((p - aint[1][1]):length())..':'..tostring((p - aint[2][1]):length()))
			if (p - aint[1][1]):length() < rmatch then
		if p:distanceToLineSegment(aint[1][1], aint[2][1]) < rmatch then
--            lo('?? for_dist:'..j..':'..tostring((p - aint[1][1]):length())..':'..tostring((p - aint[2][1]):length()))
			if (p - aint[1][1]):length() < rmatch then
	end
		U.dump(avclose, '?? CLOSE:'..tostring(cvHit1)..':'..tostring(cvHit2))
--    lo('?? jcut:'..tostring(jcut))
	end
		U.dump(avclose, '?? CLOSE:'..tostring(cvHit1)..':'..tostring(cvHit2))
--    lo('?? jcut:'..tostring(jcut))
		U.dump(avclose, '?? CLOSE:'..tostring(cvHit1)..':'..tostring(cvHit2))
--    lo('?? jcut:'..tostring(jcut))
		if ind == je then
			lo('?? for_last:'..tostring(cut[1][3])..':'..#b1)
			if not cut[1][3] then
		desc.acorner_ = cornersBuild(desc)
	--        U.dump(desc.acorner_, '?? wallCollapse_corner:'..tostring(redraw))
	end
	if cij == nil or cij[1] == nil then return end
		U.dump(out.asplit, '>> wallSplit:'..scope..':'..tostring(out.wsplit)) --..':'..cij[1]..':'..cij[2]..':'..tostring(cedit.part))
		U.dump(adesc[cedit.mesh].afloor[cij[1]].base)
	if cij == nil or cij[1] == nil then return end
		U.dump(out.asplit, '>> wallSplit:'..scope..':'..tostring(out.wsplit)) --..':'..cij[1]..':'..cij[2]..':'..tostring(cedit.part))
		U.dump(adesc[cedit.mesh].afloor[cij[1]].base)
			for i,e in pairs(out.asplit) do
					U.dump(e, '?? u:'..i..':'..e.u..':'..tostring(base2world(adesc[cedit.mesh], e.ij)))
				local w = floor.awall[e.ij[2]]
				local t,u,v = ray2rect(base2world(adesc[cedit.mesh], e.ij), w.u, w.v, getCameraMouseRay())
--                    U.dump({u*w.u:normalized(),v*w.v:normalized()},'?? u_v:'..tostring(u)..':'..tostring(v))
				w.achild[#w.achild+1] = {ij = e.ij, rc = {{0,0},{1,v*w.v:normalized()}}}
				local t,u,v = ray2rect(base2world(adesc[cedit.mesh], e.ij), w.u, w.v, getCameraMouseRay())
--                    U.dump({u*w.u:normalized(),v*w.v:normalized()},'?? u_v:'..tostring(u)..':'..tostring(v))
				w.achild[#w.achild+1] = {ij = e.ij, rc = {{0,0},{1,v*w.v:normalized()}}}
local function forKey(rayCast)
--		lo('>> forKey:'..tostring(rayCast))
	if rayCast == nil then return end
	local its = fdata:getItemsCircle(rayCast.pos, 0.2)
--		lo('>> forKey:'..tostring(rayCast))
	if not cij then return end
			else
					lo('?? for_f:'..tostring(itm.visibility)..':'..tostring(itm:getData()))
--				itm:setPosition(vec3(0,0,0))
			else
					lo('?? for_f:'..tostring(itm.visibility)..':'..tostring(itm:getData()))
--				itm:setPosition(vec3(0,0,0))
	local base = desc.afloor[ij[1]].base
		U.dump(ij, '?? wallHit:'..tostring(desc.afloor[ij[1]].base[ij[2]])..':'..tostring(desc.pos)..':'..tostring(desc.afloor[ij[1]].pos)..':')
	local d = intersectsRay_Plane(ray.pos, ray.dir,
	local base = desc.afloor[ij[1]].base
		U.dump(ij, '?? wallHit:'..tostring(desc.afloor[ij[1]].base[ij[2]])..':'..tostring(desc.pos)..':'..tostring(desc.afloor[ij[1]].pos)..':')
	local d = intersectsRay_Plane(ray.pos, ray.dir,
	local base = desc.afloor[ij[1]].base
		U.dump(ij, '?? wallHit:'..tostring(desc.afloor[ij[1]].base[ij[2]])..':'..tostring(desc.pos)..':'..tostring(desc.afloor[ij[1]].pos)..':')
	local d = intersectsRay_Plane(ray.pos, ray.dir,
	local phit = U.ray2plane(ray,p,vec3(0,0,1))
--      lo('>> ray2rc:'..i..':'..tostring(ray.dir)..':'..#floor.top.achild)
--                        U.dump(desctop.base,'??^^^^^^^^^^^^^^^^^^^^^ ifHit:'..tostring(desctop.shape)..':'..tostring(phit)..':'..tostring(p))
--      lo('>> ray2rc:'..i..':'..tostring(ray.dir)..':'..#floor.top.achild)
--                        U.dump(desctop.base,'??^^^^^^^^^^^^^^^^^^^^^ ifHit:'..tostring(desctop.shape)..':'..tostring(phit)..':'..tostring(p))
	for k,c in pairs(floor.top.achild) do
--      lo('>> ray2rc:'..i..':'..tostring(ray.dir)..':'..#floor.top.achild)
--                        U.dump(desctop.base,'??^^^^^^^^^^^^^^^^^^^^^ ifHit:'..tostring(desctop.shape)..':'..tostring(phit)..':'..tostring(p))
	for k,c in pairs(floor.top.achild) do
--      lo('>> ray2rc:'..i..':'..tostring(ray.dir)..':'..#floor.top.achild)
--                        U.dump(desctop.base,'??^^^^^^^^^^^^^^^^^^^^^ ifHit:'..tostring(desctop.shape)..':'..tostring(phit)..':'..tostring(p))
	for k,c in pairs(floor.top.achild) do
		local inrc = U.inRC(phit, arc)
--			U.dump(arc,'??^^^^^^^^^^^^^^^^^^^^^ r2r:'..k..':'..tostring(phit)..':'..tostring(inrc))
--        local inrc = U.inRC(phit, {cbase})
		local inrc = U.inRC(phit, arc)
--			U.dump(arc,'??^^^^^^^^^^^^^^^^^^^^^ r2r:'..k..':'..tostring(phit)..':'..tostring(inrc))
--        local inrc = U.inRC(phit, {cbase})
--        local inrc = U.inRC(phit, {cbase})
--                U.dump(cbase,'?? inrc:'..k..':'..tostring(inrc))--..':'..tostring(desctop.shape))
		if inrc then
--        local inrc = U.inRC(phit, {cbase})
--                U.dump(cbase,'?? inrc:'..k..':'..tostring(inrc))--..':'..tostring(desctop.shape))
		if inrc then
	p.z = 0
			lo('?? forRoofHit1:'..tostring(h)..':'..tostring(d)..':'..tostring(p)) --..':'..#floor.top.body)
--            U.dump(lastFloor.top.body, '?? mup.floors:'..#adesc[cedit.mesh].afloor..':'..tostring(p))
	p.z = 0
			lo('?? forRoofHit1:'..tostring(h)..':'..tostring(d)..':'..tostring(p)) --..':'..#floor.top.body)
--            U.dump(lastFloor.top.body, '?? mup.floors:'..#adesc[cedit.mesh].afloor..':'..tostring(p))
	p.z = 0
			lo('?? forRoofHit1:'..tostring(h)..':'..tostring(d)..':'..tostring(p)) --..':'..#floor.top.body)
--            U.dump(lastFloor.top.body, '?? mup.floors:'..#adesc[cedit.mesh].afloor..':'..tostring(p))
			lo('?? forRoofHit1:'..tostring(h)..':'..tostring(d)..':'..tostring(p)) --..':'..#floor.top.body)
--            U.dump(lastFloor.top.body, '?? mup.floors:'..#adesc[cedit.mesh].afloor..':'..tostring(p))
	if not floor.top then return nil end
	local inrc,d1,d2 = U.inRC(p, floor.top.body)
--            lo('?? forRoofHit2:'..tostring(inrc))
--            U.dump(floor.top.body, '?? forRoofHit2:'..tostring(inrc)..':'..tostring(d1)..':'..tostring(d2))
--            lo('?? forRoofHit2:'..tostring(inrc))
--            U.dump(floor.top.body, '?? forRoofHit2:'..tostring(inrc)..':'..tostring(d1)..':'..tostring(d2))
	local id, ichild = floor.top.id, nil
--            lo('?? forRoofHit2:'..tostring(inrc))
--            U.dump(floor.top.body, '?? forRoofHit2:'..tostring(inrc)..':'..tostring(d1)..':'..tostring(d2))
	local id, ichild = floor.top.id, nil
--            lo('?? forRoofHit2:'..tostring(inrc))
--            U.dump(floor.top.body, '?? forRoofHit2:'..tostring(inrc)..':'..tostring(d1)..':'..tostring(d2))
	local id, ichild = floor.top.id, nil
	local id, ichild = floor.top.id, nil
--        U.dump(floor.top.body,'?? forRoofHit.pre_child:'..#floor.top.achild..' inrc:'..tostring(inrc), true)
	ichild = W.ray2rc(ray, floor)
	ichild = W.ray2rc(ray, floor)
		lo('?? rH.child:'..tostring(ichild))
	return id,inrc,ichild
	local floor = house.afloor[ifloor]
--        lo('?? floorClone:'..tostring(floor.top.shape))
	base = base ~= nil and base or floor.base
	newfloor.top.body = coverUp(mbase)
--    lo('<< floorClone:'..tostring(newfloor.top.shape))
local function floorAppend()
		U.dump(cedit.cval, '>> floorAppend:'..cij[1]..':'..tostring(intopchange))
--        if true then return end
			local function ifHit(desctop,base)
--          U.dump(ijmi,'>> ifHit:'..i..':'..tostring(base),true)
				if base then
					local phit = U.ray2plane(ray,p,vec3(0,0,1))
--                        U.dump(desctop.base,'??^^^^^^^^^^^^^^^^^^^^^ ifHit:'..tostring(desctop.shape)..':'..tostring(phit)..':'..tostring(p))
					local cbase = {}
					local phit = U.ray2plane(ray,p,vec3(0,0,1))
--                        U.dump(desctop.base,'??^^^^^^^^^^^^^^^^^^^^^ ifHit:'..tostring(desctop.shape)..':'..tostring(phit)..':'..tostring(p))
					local cbase = {}
					local phit = U.ray2plane(ray,p,vec3(0,0,1))
--                        U.dump(desctop.base,'??^^^^^^^^^^^^^^^^^^^^^ ifHit:'..tostring(desctop.shape)..':'..tostring(phit)..':'..tostring(p))
					local cbase = {}
					local inrc = U.inRC(phit, {cbase})
--                        U.dump(cbase,'?? ifHit.inrc:'..i..':'..tostring(p)..':'..tostring(inrc)..':'..tostring(desctop.shape)..':'..i..':'..tostring(base2world(desc,{i,1},base[1])))
					if inrc then
					local inrc = U.inRC(phit, {cbase})
--                        U.dump(cbase,'?? ifHit.inrc:'..i..':'..tostring(p)..':'..tostring(inrc)..':'..tostring(desctop.shape)..':'..i..':'..tostring(base2world(desc,{i,1},base[1])))
					if inrc then
					local inrc = U.inRC(phit, {cbase})
--                        U.dump(cbase,'?? ifHit.inrc:'..i..':'..tostring(p)..':'..tostring(inrc)..':'..tostring(desctop.shape)..':'..i..':'..tostring(base2world(desc,{i,1},base[1])))
					if inrc then
					local inrc = U.inRC(phit, {cbase})
--                        U.dump(cbase,'?? ifHit.inrc:'..i..':'..tostring(p)..':'..tostring(inrc)..':'..tostring(desctop.shape)..':'..i..':'..tostring(base2world(desc,{i,1},base[1])))
					if inrc then
					if inrc then
--              U.dump(cbase,'?? inRC:'..i..':'..tostring(phit))
						dmi = (ray.pos-phit):length()
				local inrc = U.inRC(phit, {base})
					lo('?? inrc:'..tostring(inrc))
]]
]]
--                lo('??***************** if_ACHILD:'..tostring(#f.top.achild), true)
				for _,c in pairs(f.top.achild) do
--                        U.dump(c.base,'?? forHit_child:'..i..':'..tostring(c.shape)..':'.._)
					ifHit(c,c.base)
--            U.dump(ijmi,'??^^^^ if_hit_ch:'..i)
--                    lo('?? if_child_af:'..tostring(#c.af)..':'..tostring(ijmi),true)
				end
--            U.dump(ijmi,'??^^^^ if_hit_ch:'..i)
--                    lo('?? if_child_af:'..tostring(#c.af)..':'..tostring(ijmi),true)
				end
					local d = (ray.pos-phit):length()
--                        lo('?? for_VN:'..k..':'..tostring(vn)..':'..tostring(phit))
					if U.inRC(phit, {r}) then
					local d = (ray.pos-phit):length()
--                        lo('?? for_VN:'..k..':'..tostring(vn)..':'..tostring(phit))
					if U.inRC(phit, {r}) then
					if U.inRC(phit, {r}) then
--                            lo('?? hit_wp:'..k..':'..d..'/'..tostring(dmi))
						if d < dmi then
				base2world(desc, {i,j+1}))
--          lo('?? if_wall_HIT1:'..j..':'..d..'>'..dmi..':'..tostring(d
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
		end
		lo('?? mdown_IF_FOREST: roof:'..tostring(id)..':'..nm)
		partOn(id)
	if nm == 'theTerrain' then
		lo('?? RH3:'..tostring(cedit.mesh))
		local id = forRoofHit(adesc[cedit.mesh])
		local id = forRoofHit(adesc[cedit.mesh])
			lo('?? check_Terr:'..tostring(id))
		if id ~= nil then
	end
			lo('?? for_nm:'..tostring(nm))
		-- check for hitting roof
		local key = forKey(rayCast)
			U.dump(cij, '?? for_cij0:'..tostring(key)) --..':'..tostring(dforest[key].mesh)..':'..scenetree.findObjectById(dforest[key].mesh).name)
		if not cij and not cedit.mesh then
		local key = forKey(rayCast)
			U.dump(cij, '?? for_cij0:'..tostring(key)) --..':'..tostring(dforest[key].mesh)..':'..scenetree.findObjectById(dforest[key].mesh).name)
		if not cij and not cedit.mesh then
			-- edit forest
			lo('?? for_key1:'..tostring(key)..'/'..tostring(cedit.forest))
			if key ~= cedit.forest then newedit = true end
			-- edit forest
			lo('?? for_key1:'..tostring(key)..'/'..tostring(cedit.forest))
			if key ~= cedit.forest then newedit = true end
							local cind = U.index(akey, key)
	--                        lo('?? ak:'.._..':'..tostring(#akey)..':'..#cind)
							if #cind > 0 then
							if #cind > 0 then
	--                            lo('?? ak_found:'..tostring(ind[1]))
								cij = U.clone(ij)
					end)
						lo('?? f_TYPE:'..tp..':'..tostring(desc)..' key:'..tostring(key)..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.mesh))
	--                    U.dump(cij, '?? for_fc:'..tostring(ind)..':'..tp..'<')
					end)
						lo('?? f_TYPE:'..tp..':'..tostring(desc)..' key:'..tostring(key)..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.mesh))
	--                    U.dump(cij, '?? for_fc:'..tostring(ind)..':'..tp..'<')
					end)
						lo('?? f_TYPE:'..tp..':'..tostring(desc)..' key:'..tostring(key)..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.mesh))
	--                    U.dump(cij, '?? for_fc:'..tostring(ind)..':'..tp..'<')
					end)
						lo('?? f_TYPE:'..tp..':'..tostring(desc)..' key:'..tostring(key)..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.mesh))
	--                    U.dump(cij, '?? for_fc:'..tostring(ind)..':'..tp..'<')
						lo('?? f_TYPE:'..tp..':'..tostring(desc)..' key:'..tostring(key)..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.mesh))
	--                    U.dump(cij, '?? for_fc:'..tostring(ind)..':'..tp..'<')
	--                cedit.forest = key
						end
	--                            lo('?? IS_IND:'..tostring(ind)..':'..cij[1]..':'..tostring(cij))
					elseif cij then
						end
	--                            lo('?? IS_IND:'..tostring(ind)..':'..cij[1]..':'..tostring(cij))
					elseif cij then
					end
	--                    lo('?? for_key2:'..tostring(cedit.forest)..' mesh:'..tostring(cedit.mesh))
				else
					end
	--                    lo('?? for_key2:'..tostring(cedit.forest)..' mesh:'..tostring(cedit.mesh))
				else
				end
	--                    lo('?? if_c:'..tostring(cij))
	--                lo('?? for_key3:'..cedit.forest..':'..tostring(dforest[cedit.forest].item)..':'..' mesh:'..tostring(cedit.mesh))
	--                    lo('?? if_c:'..tostring(cij))
	--                lo('?? for_key3:'..cedit.forest..':'..tostring(dforest[cedit.forest].item)..':'..' mesh:'..tostring(cedit.mesh))
	--                editor.removeForestItem(fdata, dforest[cedit.forest].item)
	--                    lo('?? if_c:'..tostring(cij))
	--                lo('?? for_key3:'..cedit.forest..':'..tostring(dforest[cedit.forest].item)..':'..' mesh:'..tostring(cedit.mesh))
	--                editor.removeForestItem(fdata, dforest[cedit.forest].item)
	--            markUp(dforest[cedit.forest].item:getData():getShapeFile())
	--                lo('?? fof:'..' mesh:'..tostring(cedit.mesh)..':'..dforest[cedit.forest].type..':'..dforest[cedit.forest].item:getData():getShapeFile())
	--                lo('?? if_cij:'..tostring(cij)..':'..tostring(dforest[cedit.forest].item:getData():getShapeFile()))
	--                lo('?? fof:'..' mesh:'..tostring(cedit.mesh)..':'..dforest[cedit.forest].type..':'..dforest[cedit.forest].item:getData():getShapeFile())
	--                lo('?? if_cij:'..tostring(cij)..':'..tostring(dforest[cedit.forest].item:getData():getShapeFile()))
					U.dump(cij, '?? for_cij:'..dforest[cedit.forest].type)
	--                lo('?? fof:'..' mesh:'..tostring(cedit.mesh)..':'..dforest[cedit.forest].type..':'..dforest[cedit.forest].item:getData():getShapeFile())
	--                lo('?? if_cij:'..tostring(cij)..':'..tostring(dforest[cedit.forest].item:getData():getShapeFile()))
					U.dump(cij, '?? for_cij:'..dforest[cedit.forest].type)
--        local its = out.fdata:getItemsCircle(rayCast.pos, 0.2)
--        lo('?? fits:'..tostring(#its))
--        if #its > 0 then
		local id = scenetree.findObject(nm):getID() --rayCast.object:getID()
				lo('?? for_o_:'..id..':'..tostring(scope)..':'..tostring(cedit.mesh)..':'..rayCast.object.name)
		if not cedit.mesh and string.find(nm, 'o_building_') == 1 then
		local id = scenetree.findObject(nm):getID() --rayCast.object:getID()
				lo('?? for_o_:'..id..':'..tostring(scope)..':'..tostring(cedit.mesh)..':'..rayCast.object.name)
		if not cedit.mesh and string.find(nm, 'o_building_') == 1 then
		end
 --               lo('?? for_obj:'..tostring(editor.keyModifiers.alt))
		if editor.keyModifiers.alt then
-- TOP SPLIT
					lo('?? for_top:'..tostring(im.IsKeyDown(im.GetKeyIndex(im.Key_Z))))
--                lo('?? rc:'..id..':'..tostring(rayCast.object)) --..rayCast.object.name)
					lo('?? for_top:'..tostring(im.IsKeyDown(im.GetKeyIndex(im.Key_Z))))
--                lo('?? rc:'..id..':'..tostring(rayCast.object)) --..rayCast.object.name)
--                houseUp(adesc[cedit.mesh], cedit.mesh)
--                    U.dump(aedit[id].desc.ij,'?? for_ws:'..cij[1]..':'..cij[2])
--                    lo('?? for_alt:'..tostring(aedit[id]))
				if aedit[id] then
--            local id,inrc = rayCast.object:getID()
					U.dump(cij,'?? hit_id:'..tostring(id)..':'..tostring(scope)..':'..tostring(rayCast.object.name)..'/'..nm)
			local desc = (id and adesc[id]) and adesc[id] or adesc[cedit.mesh] --or adesc[id]
--            local id,inrc = rayCast.object:getID()
					U.dump(cij,'?? hit_id:'..tostring(id)..':'..tostring(scope)..':'..tostring(rayCast.object.name)..'/'..nm)
			local desc = (id and adesc[id]) and adesc[id] or adesc[cedit.mesh] --or adesc[id]
--            local id,inrc = rayCast.object:getID()
					U.dump(cij,'?? hit_id:'..tostring(id)..':'..tostring(scope)..':'..tostring(rayCast.object.name)..'/'..nm)
			local desc = (id and adesc[id]) and adesc[id] or adesc[cedit.mesh] --or adesc[id]
--            end
	--            lo('?? mdown_dim:'..id..':'..tostring(adesc[id].pos)..':'..tostring(obj:getObjectBox():getExtents()))
			if string.find(nm, 'o_building_') == 1 then
--            end
	--            lo('?? mdown_dim:'..id..':'..tostring(adesc[id].pos)..':'..tostring(obj:getObjectBox():getExtents()))
			if string.find(nm, 'o_building_') == 1 then
				ccenter = adesc[id].pos + vec3(-ext.x, -ext.y, ext.z)/2
						lo('??+++++ CENTER:'..tostring(ccenter))
--                    U.dump(adesc[id].afloor[2].awall[1].ij, '?? PRE_split:')
--                    U.dump(cij, '?? RH4:')
					lo('?? DESC:'..tostring(desc))
				id = forRoofHit(desc)
				id = forRoofHit(desc)
					lo('?? name_after_split:'..rayCast.object.name..':'..tostring(id)) --..':'..tostring(inrc))
--                    lo('?? for_id:'..tostring(desc.afloor[#desc.afloor].top.id))
				id = forRoofHit(desc)
					lo('?? name_after_split:'..rayCast.object.name..':'..tostring(id)) --..':'..tostring(inrc))
--                    lo('?? for_id:'..tostring(desc.afloor[#desc.afloor].top.id))
					lo('?? name_after_split:'..rayCast.object.name..':'..tostring(id)) --..':'..tostring(inrc))
--                    lo('?? for_id:'..tostring(desc.afloor[#desc.afloor].top.id))
				if id == nil and rayCast.object.name ~= 'theTerrain' then
						smouse = wallHit(desc, aedit[id].desc.ij)
							lo('?? smouse:'..tostring(smouse)..':'..rayCast.object.name)
					end
			elseif string.find(nm, 'o_lid_') ~= 1 then
--                    U.dump(desc.afloor[#desc.afloor].top, '?? PRE_roof:'..tostring(cij[1])..':'..tostring(nm))
				local roofid,inrc,ichild = forRoofHit(desc,cij[1])
			elseif string.find(nm, 'o_lid_') ~= 1 then
--                    U.dump(desc.afloor[#desc.afloor].top, '?? PRE_roof:'..tostring(cij[1])..':'..tostring(nm))
				local roofid,inrc,ichild = forRoofHit(desc,cij[1])
				local roofid,inrc,ichild = forRoofHit(desc,cij[1])
					lo('?? EDIT_goon:'..tostring(cij[1])..':'..tostring(roofid)..'/'..tostring(id)..':'..tostring(ichild))
				if roofid ~= nil then
				local roofid,inrc,ichild = forRoofHit(desc,cij[1])
					lo('?? EDIT_goon:'..tostring(cij[1])..':'..tostring(roofid)..'/'..tostring(id)..':'..tostring(ichild))
				if roofid ~= nil then
				local roofid,inrc,ichild = forRoofHit(desc,cij[1])
					lo('?? EDIT_goon:'..tostring(cij[1])..':'..tostring(roofid)..'/'..tostring(id)..':'..tostring(ichild))
				if roofid ~= nil then
				local roofid,inrc,ichild = forRoofHit(desc,cij[1])
					lo('?? EDIT_goon:'..tostring(cij[1])..':'..tostring(roofid)..'/'..tostring(id)..':'..tostring(ichild))
				if roofid ~= nil then
--                lo('?? ED_OBJ:'..id)
					lo('?? for_part:'..tostring(id)..':'..tostring(scope)..':'..tostring(cedit.part))
			if id ~= cedit.part then
--                lo('?? ED_OBJ:'..id)
					lo('?? for_part:'..tostring(id)..':'..tostring(scope)..':'..tostring(cedit.part))
			if id ~= cedit.part then
--                lo('?? ED_OBJ:'..id)
					lo('?? for_part:'..tostring(id)..':'..tostring(scope)..':'..tostring(cedit.part))
			if id ~= cedit.part then
	end
--            lo('?? drag:'..tostring(mcam))
	table.insert(adwin, 1, mcam)
	end
--        lo('?? drag2:'..tostring(mcam)..':'..tostring(u)..':'..tostring(v))
--                    lo('?? cam_frame:'..tostring(cx)..':'..tostring(cy)..' MCAM:'..tostring(mcam))
	end
--        lo('?? drag2:'..tostring(mcam)..':'..tostring(u)..':'..tostring(v))
--                    lo('?? cam_frame:'..tostring(cx)..':'..tostring(cy)..' MCAM:'..tostring(mcam))
	end
--        lo('?? drag2:'..tostring(mcam)..':'..tostring(u)..':'..tostring(v))
--                    lo('?? cam_frame:'..tostring(cx)..':'..tostring(cy)..' MCAM:'..tostring(mcam))
--        lo('?? drag2:'..tostring(mcam)..':'..tostring(u)..':'..tostring(v))
--                    lo('?? cam_frame:'..tostring(cx)..':'..tostring(cy)..' MCAM:'..tostring(mcam))
--                        lo('?? uvm:'..tostring(upcam)..':'..tostring(vpcam)..':'..tostring(mcam))
--        lo('?? drag2:'..tostring(mcam)..':'..tostring(u)..':'..tostring(v))
--                    lo('?? cam_frame:'..tostring(cx)..':'..tostring(cy)..' MCAM:'..tostring(mcam))
--                        lo('?? uvm:'..tostring(upcam)..':'..tostring(vpcam)..':'..tostring(mcam))
--        lo('?? drag2:'..tostring(mcam)..':'..tostring(u)..':'..tostring(v))
--                    lo('?? cam_frame:'..tostring(cx)..':'..tostring(cy)..' MCAM:'..tostring(mcam))
--                        lo('?? uvm:'..tostring(upcam)..':'..tostring(vpcam)..':'..tostring(mcam))
--                    lo('?? cam_frame:'..tostring(cx)..':'..tostring(cy)..' MCAM:'..tostring(mcam))
--                        lo('?? uvm:'..tostring(upcam)..':'..tostring(vpcam)..':'..tostring(mcam))
--    return math.abs(mcam:dot(upcam)) > math.abs(mcam:dot(vpcam))
--                    lo('?? cam_frame:'..tostring(cx)..':'..tostring(cy)..' MCAM:'..tostring(mcam))
--                        lo('?? uvm:'..tostring(upcam)..':'..tostring(vpcam)..':'..tostring(mcam))
--    return math.abs(mcam:dot(upcam)) > math.abs(mcam:dot(vpcam))
--                    lo('?? cam_frame:'..tostring(cx)..':'..tostring(cy)..' MCAM:'..tostring(mcam))
--                        lo('?? uvm:'..tostring(upcam)..':'..tostring(vpcam)..':'..tostring(mcam))
--    return math.abs(mcam:dot(upcam)) > math.abs(mcam:dot(vpcam))
local function inCube(meshID, frame)
--        lo('>> inCube:'..tostring(cmesh))
--        out.avedit = {}
--            m.faces = U.clone(data[ord])
--                lo('?? inCube_F:'..tostring(#faces))
			for i = 1,#faces,6 do

--            lo('?? mdrag.smouse:'..tostring(smouse)..':'..tostring(#out.dyell))
--        lo('?? for_VEDGE:'..tostring(smouse)..':'..tostring(incorner)..':'..tostring(out.invertedge), true)

--            lo('?? mdrag.smouse:'..tostring(smouse)..':'..tostring(#out.dyell))
--        lo('?? for_VEDGE:'..tostring(smouse)..':'..tostring(incorner)..':'..tostring(out.invertedge), true)
--            lo('?? mdrag.smouse:'..tostring(smouse)..':'..tostring(#out.dyell))
--        lo('?? for_VEDGE:'..tostring(smouse)..':'..tostring(incorner)..':'..tostring(out.invertedge), true)
	if smouse == nil then
--            lo('?? mdrag.smouse:'..tostring(smouse)..':'..tostring(#out.dyell))
--        lo('?? for_VEDGE:'..tostring(smouse)..':'..tostring(incorner)..':'..tostring(out.invertedge), true)
	if smouse == nil then
--            lo('?? mdrag.smouse:'..tostring(smouse)..':'..tostring(#out.dyell))
--        lo('?? for_VEDGE:'..tostring(smouse)..':'..tostring(incorner)..':'..tostring(out.invertedge), true)
	if smouse == nil then
	end
--		lo('?? mdrag:'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--		lo('?? W.DRAG:'..tostring(out.acorner)..':'..tostring(out.invertedge)..':'..tostring(out.inhole)..':'..tostring(cedit.cval['DragRot'])..':'..tostring(out.acorner)) --..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
	end
--		lo('?? mdrag:'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--		lo('?? W.DRAG:'..tostring(out.acorner)..':'..tostring(out.invertedge)..':'..tostring(out.inhole)..':'..tostring(cedit.cval['DragRot'])..':'..tostring(out.acorner)) --..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--		lo('?? mdrag:'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--		lo('?? W.DRAG:'..tostring(out.acorner)..':'..tostring(out.invertedge)..':'..tostring(out.inhole)..':'..tostring(cedit.cval['DragRot'])..':'..tostring(out.acorner)) --..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--        _dbdrag = true
--		lo('?? mdrag:'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--		lo('?? W.DRAG:'..tostring(out.acorner)..':'..tostring(out.invertedge)..':'..tostring(out.inhole)..':'..tostring(cedit.cval['DragRot'])..':'..tostring(out.acorner)) --..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--        _dbdrag = true
--		lo('?? mdrag:'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--		lo('?? W.DRAG:'..tostring(out.acorner)..':'..tostring(out.invertedge)..':'..tostring(out.inhole)..':'..tostring(cedit.cval['DragRot'])..':'..tostring(out.acorner)) --..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--        _dbdrag = true
--		lo('?? mdrag:'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--		lo('?? W.DRAG:'..tostring(out.acorner)..':'..tostring(out.invertedge)..':'..tostring(out.inhole)..':'..tostring(cedit.cval['DragRot'])..':'..tostring(out.acorner)) --..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--        _dbdrag = true
--		lo('?? mdrag:'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--		lo('?? W.DRAG:'..tostring(out.acorner)..':'..tostring(out.invertedge)..':'..tostring(out.inhole)..':'..tostring(cedit.cval['DragRot'])..':'..tostring(out.acorner)) --..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--        _dbdrag = true
--		lo('?? mdrag:'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--		lo('?? W.DRAG:'..tostring(out.acorner)..':'..tostring(out.invertedge)..':'..tostring(out.inhole)..':'..tostring(cedit.cval['DragRot'])..':'..tostring(out.acorner)) --..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--        _dbdrag = true
--		lo('?? mdrag:'..tostring(cedit.forest)..':'..tostring(cedit.fscope))
--		lo('?? W.DRAG:'..tostring(out.acorner)..':'..tostring(out.invertedge)..':'..tostring(out.inhole)..':'..tostring(cedit.cval['DragRot'])..':'..tostring(out.acorner)) --..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--        _dbdrag = true
--            lo('?? mdrag:') --..dwin[1]..':'..dwin[2]..':'..rayCast.object.name)
--            lo('?? mdrag:'..tostring(ds)..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest].item:getScale()))
--            U.dump(dforest, '?? mdrag.dforest:')
--            lo('?? mdrag:') --..dwin[1]..':'..dwin[2]..':'..rayCast.object.name)
--            lo('?? mdrag:'..tostring(ds)..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest].item:getScale()))
--            U.dump(dforest, '?? mdrag.dforest:')
--            lo('?? mdrag:') --..dwin[1]..':'..dwin[2]..':'..rayCast.object.name)
--            lo('?? mdrag:'..tostring(ds)..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest].item:getScale()))
--            U.dump(dforest, '?? mdrag.dforest:')
--		if editor.keyModifiers.shift then
--            lo('??+++++++++++++++++++++++++++ drag_split:'..tostring(out.acorner)..':'..tostring(out.invertedge), true)
--		end
--		if editor.keyModifiers.shift then
--            lo('??+++++++++++++++++++++++++++ drag_split:'..tostring(out.acorner)..':'..tostring(out.invertedge), true)
--		end
				out.inhole = nil
--        U.dump(adesc[cedit.mesh], '?? drag_hole:'..tostring(smouse)..':'..adesc[cedit.mesh].id)
--        lo('?? drag_hole:'..tostring(smouse)..':'..adesc[cedit.mesh].afloor[cij[1]].awall[cij[2]].id)
--        U.dump(adesc[cedit.mesh], '?? drag_hole:'..tostring(smouse)..':'..adesc[cedit.mesh].id)
--        lo('?? drag_hole:'..tostring(smouse)..':'..adesc[cedit.mesh].afloor[cij[1]].awall[cij[2]].id)
		return
					for j,key in pairs(f) do
--							lo('?? if_SPL:'..tostring(s))
						if not tonumber(key) and desc.aspline[i] then
								for k,b in pairs(s.base) do
	--									lo('?? if_NODE:'..k..':'..tostring(b+vec3(0,0,s.box.minExtents.z))..':'..tostring(b+vec3(0,0,s.box.maxExtents.z)))
									if U.angDistVert(b+vec3(0,0,s.box.minExtents.z),b+vec3(0,0,s.box.maxExtents.z)) then
								for k,b in pairs(s.base) do
	--									lo('?? if_NODE:'..k..':'..tostring(b+vec3(0,0,s.box.minExtents.z))..':'..tostring(b+vec3(0,0,s.box.maxExtents.z)))
									if U.angDistVert(b+vec3(0,0,s.box.minExtents.z),b+vec3(0,0,s.box.maxExtents.z)) then
											local d = intersectsRay_Plane(ray.pos, ray.dir, p, vec3(0,0,1))
												lo('?? dragStart:'..tostring(p)..':'..tostring(d))
											cedit.cval['DragPos'] = {pos=p, node=s.base[k], dend = {}}
											local d = intersectsRay_Plane(ray.pos, ray.dir, p, vec3(0,0,1))
												lo('?? dragStart:'..tostring(p)..':'..tostring(d))
											cedit.cval['DragPos'] = {pos=p, node=s.base[k], dend = {}}
--												dp = vec3(1,0,0)
											lo('?? for_DRAG_POS:'..tostring(dp)) --p-cedit.cval['DragPos'].pos)) --..tostring(ray.dir)..':'..tostring(cedit.cval['DragPos'].pos)..'/'..tostring(p))
										-- move node
--												dp = vec3(1,0,0)
											lo('?? for_DRAG_POS:'..tostring(dp)) --p-cedit.cval['DragPos'].pos)) --..tostring(ray.dir)..':'..tostring(cedit.cval['DragPos'].pos)..'/'..tostring(p))
										-- move node
--												dp = vec3(1,0,0)
											lo('?? for_DRAG_POS:'..tostring(dp)) --p-cedit.cval['DragPos'].pos)) --..tostring(ray.dir)..':'..tostring(cedit.cval['DragPos'].pos)..'/'..tostring(p))
										-- move node
--												dp = vec3(1,0,0)
											lo('?? for_DRAG_POS:'..tostring(dp)) --p-cedit.cval['DragPos'].pos)) --..tostring(ray.dir)..':'..tostring(cedit.cval['DragPos'].pos)..'/'..tostring(p))
										-- move node
										end
--												U.dump(cedit.cval['DragPos'].dend,'?? if_base:'..iw..':'..tostring(isave))
										if iw then
	if cedit.forest and cedit.fscope == 1 then
			lo('?? drag_FOR:'..tostring(cedit.forest))
-- DRAG FOREST ITEM
		local desc = adesc[cedit.mesh]
--			U.dump(desc.selection, '?? fdrag:'..tostring(cij[2]))
		forBuilding(desc, function(w,ij)
					cedit.cval['DragPos'] = {cpos = rayCast.pos, s = vec3(0,0)}
						lo('?? rcp:'..tostring(rayCast.pos))
					for i,d in pairs(desc.aspline[ij[1]][ij[2]].aforest) do
					cedit.cval['DragPos'].s = cedit.cval['DragPos'].s + vec3(x,y)
						lo('?? mdrag.spline_ds:'..d..':'..tostring(cedit.cval['DragPos'].s)..':'..cedit.forest) --..':'..rayCast.object.name) --..tostring(p-cedit.cval['DragPos'].mouse))
	--					cedit.cval['DragPos'].s = vec3(0,-0.2)
					cedit.cval['DragPos'].s = cedit.cval['DragPos'].s + vec3(x,y)
						lo('?? mdrag.spline_ds:'..d..':'..tostring(cedit.cval['DragPos'].s)..':'..cedit.forest) --..':'..rayCast.object.name) --..tostring(p-cedit.cval['DragPos'].mouse))
	--					cedit.cval['DragPos'].s = vec3(0,-0.2)
						if d.key == cedit.forest then
								lo('??******************* fof:'..tostring(ds))
	--							U.dump(d,'?? fof:'..tostring(cedit.cval['DragPos'].s))
								lo('??******************* fof:'..tostring(ds))
	--							U.dump(d,'?? fof:'..tostring(cedit.cval['DragPos'].s))
							d.p = cedit.cval['DragPos'].fpos + ds
	elseif out.acorner and ({building=1,floor=1,wall=1})[scope] then -- and (not editor.keyModifiers.ctrl and not incorner) then
			lo('?? drag_CORNER:',true) --..tostring(out.invertedge),true)
--      _dbdrag = true
				local j = out.acorner[1].ij[2]
--                    lo('?? acorn:'..tostring(out.acorner[1].ij[2]),true)
				local upre = U.mod(j, floor.base) - U.mod(j-1, floor.base)
		elseif not im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
--                lo('?? corner_DRAG:'..tostring(editor.keyModifiers.ctrl), true)
-- MOVE CORNER freehand
--				lo('?? mdrag.corner_DRAG:')
--                lo('?? for_CORNER_move:'..tostring(cij[1])..':'..tostring(cij[2]), true)
--                U.dump(out.acorner, '?? acorner:')
--				lo('?? mdrag.corner_DRAG:')
--                lo('?? for_CORNER_move:'..tostring(cij[1])..':'..tostring(cij[2]), true)
--                U.dump(out.acorner, '?? acorner:')
				pairend,pair,imap = W.ifPairEnd() --nil,true)
          			lo('?? if_PAIREND:'..tostring(pairend)..':'..tostring(cij), true)
--          _dbdrag = true
				pairend,pair,imap = W.ifPairEnd() --nil,true)
          			lo('?? if_PAIREND:'..tostring(pairend)..':'..tostring(cij), true)
--          _dbdrag = true
				cedit.cval['DragPos'] = {pos = t}
					U.dump(pair,'??+++++++++++++++++++++++++++++ DRAG_freehand:'..tostring(ij[1])..':'..tostring(ij[2])..':'..#out.acorner..':'..tostring(incorner and #incorner or nil)..':'..tostring(pairend)..':'..tostring(scope), true)
--                    _dbdrag = true
				cedit.cval['DragPos'] = {pos = t}
					U.dump(pair,'??+++++++++++++++++++++++++++++ DRAG_freehand:'..tostring(ij[1])..':'..tostring(ij[2])..':'..#out.acorner..':'..tostring(incorner and #incorner or nil)..':'..tostring(pairend)..':'..tostring(scope), true)
--                    _dbdrag = true
				cedit.cval['DragPos'] = {pos = t}
					U.dump(pair,'??+++++++++++++++++++++++++++++ DRAG_freehand:'..tostring(ij[1])..':'..tostring(ij[2])..':'..#out.acorner..':'..tostring(incorner and #incorner or nil)..':'..tostring(pairend)..':'..tostring(scope), true)
--                    _dbdrag = true
				cedit.cval['DragPos'] = {pos = t}
					U.dump(pair,'??+++++++++++++++++++++++++++++ DRAG_freehand:'..tostring(ij[1])..':'..tostring(ij[2])..':'..#out.acorner..':'..tostring(incorner and #incorner or nil)..':'..tostring(pairend)..':'..tostring(scope), true)
--                    _dbdrag = true
				cedit.cval['DragPos'] = {pos = t}
					U.dump(pair,'??+++++++++++++++++++++++++++++ DRAG_freehand:'..tostring(ij[1])..':'..tostring(ij[2])..':'..#out.acorner..':'..tostring(incorner and #incorner or nil)..':'..tostring(pairend)..':'..tostring(scope), true)
--                    _dbdrag = true
--                    pair,ind,map = W.ifPairHit({incorner[1].ij[1],U.mod(incorner[1].ij[2]-1,#floor.base)})
--                    U.dump(pair, '?? PH:'..tostring(ind)..':'..tostring(map))
				if editor.keyModifiers.ctrl then
--                    pair,ind,map = W.ifPairHit({incorner[1].ij[1],U.mod(incorner[1].ij[2]-1,#floor.base)})
--                    U.dump(pair, '?? PH:'..tostring(ind)..':'..tostring(map))
				if editor.keyModifiers.ctrl then
						end
							lo('?? if_DIR:'..tostring(isperp)..':'..tostring(mdir)..':'..tostring(inalong),true)
			--              return
						end
							lo('?? if_DIR:'..tostring(isperp)..':'..tostring(mdir)..':'..tostring(inalong),true)
			--              return
						end
							lo('?? if_DIR:'..tostring(isperp)..':'..tostring(mdir)..':'..tostring(inalong),true)
			--              return
						end
							U.dump(incorner, '?? incorner:'..scope..':'..cij[2]..':'..tostring(inalong))
			--                _dbdrag = true
								ang = ang>0 and -(2*math.pi-ang) or ang
				--                  lo('??************* eB:'..tostring(u1)..':'..tostring(u2)..' ang:'..tostring(ang))
								if math.abs(math.abs(ang)-math.pi)
								ang = ang>0 and -(2*math.pi-ang) or ang
				--                  lo('??************* eB:'..tostring(u1)..':'..tostring(u2)..' ang:'..tostring(ang))
								if math.abs(math.abs(ang)-math.pi)
								ang = ang>0 and -(2*math.pi-ang) or ang
				--                  lo('??************* eB:'..tostring(u1)..':'..tostring(u2)..' ang:'..tostring(ang))
								if math.abs(math.abs(ang)-math.pi)
								local v = U.vturn(u2, -ang/2)
				--									lo('?? pre_SPLIT: floor:'..c.ij[1]..':'..ind..':'..tostring(base[ind])..' v:'..tostring(v)..' ang:'..tostring(ang)..':'..#base,true)
								local mi,imi,vmi=math.huge
								local v = U.vturn(u2, -ang/2)
				--									lo('?? pre_SPLIT: floor:'..c.ij[1]..':'..ind..':'..tostring(base[ind])..' v:'..tostring(v)..' ang:'..tostring(ang)..':'..#base,true)
								local mi,imi,vmi=math.huge
								local v = U.vturn(u2, -ang/2)
				--									lo('?? pre_SPLIT: floor:'..c.ij[1]..':'..ind..':'..tostring(base[ind])..' v:'..tostring(v)..' ang:'..tostring(ang)..':'..#base,true)
								local mi,imi,vmi=math.huge
									if math.abs(j-ind) > 1 then
						--                                    lo('?? pre_CROSS:'..tostring(base[ind])..':'..tostring(base[ind]+v)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
										local x,y = U.lineCross(base[ind],base[ind]+v,base[j],U.mod(j+1,base))
									if math.abs(j-ind) > 1 then
						--                                    lo('?? pre_CROSS:'..tostring(base[ind])..':'..tostring(base[ind]+v)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
										local x,y = U.lineCross(base[ind],base[ind]+v,base[j],U.mod(j+1,base))
									if math.abs(j-ind) > 1 then
						--                                    lo('?? pre_CROSS:'..tostring(base[ind])..':'..tostring(base[ind]+v)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
										local x,y = U.lineCross(base[ind],base[ind]+v,base[j],U.mod(j+1,base))
									if math.abs(j-ind) > 1 then
						--                                    lo('?? pre_CROSS:'..tostring(base[ind])..':'..tostring(base[ind]+v)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
										local x,y = U.lineCross(base[ind],base[ind]+v,base[j],U.mod(j+1,base))
										local d = (vec3(x,y)-base[ind]):length()
					--											lo('?? for_D:'..j..' b1:'..tostring(base[j])..' b2:'..tostring(U.mod(j+1,base))..' x:'..tostring(x)..'y:'..tostring(y)..':'..tostring(base[ind])..' d:'..tostring(d))
										if d < mi and U.toLine(base[ind],{base[j],U.mod(j+1,base)}) > small_dist then
										local d = (vec3(x,y)-base[ind]):length()
					--											lo('?? for_D:'..j..' b1:'..tostring(base[j])..' b2:'..tostring(U.mod(j+1,base))..' x:'..tostring(x)..'y:'..tostring(y)..':'..tostring(base[ind])..' d:'..tostring(d))
										if d < mi and U.toLine(base[ind],{base[j],U.mod(j+1,base)}) > small_dist then
										local d = (vec3(x,y)-base[ind]):length()
					--											lo('?? for_D:'..j..' b1:'..tostring(base[j])..' b2:'..tostring(U.mod(j+1,base))..' x:'..tostring(x)..'y:'..tostring(y)..':'..tostring(base[ind])..' d:'..tostring(d))
										if d < mi and U.toLine(base[ind],{base[j],U.mod(j+1,base)}) > small_dist then
										local d = (vec3(x,y)-base[ind]):length()
					--											lo('?? for_D:'..j..' b1:'..tostring(base[j])..' b2:'..tostring(U.mod(j+1,base))..' x:'..tostring(x)..'y:'..tostring(y)..':'..tostring(base[ind])..' d:'..tostring(d))
										if d < mi and U.toLine(base[ind],{base[j],U.mod(j+1,base)}) > small_dist then
										local d = (vec3(x,y)-base[ind]):length()
					--											lo('?? for_D:'..j..' b1:'..tostring(base[j])..' b2:'..tostring(U.mod(j+1,base))..' x:'..tostring(x)..'y:'..tostring(y)..':'..tostring(base[ind])..' d:'..tostring(d))
										if d < mi and U.toLine(base[ind],{base[j],U.mod(j+1,base)}) > small_dist then
										local d = (vec3(x,y)-base[ind]):length()
					--											lo('?? for_D:'..j..' b1:'..tostring(base[j])..' b2:'..tostring(U.mod(j+1,base))..' x:'..tostring(x)..'y:'..tostring(y)..':'..tostring(base[ind])..' d:'..tostring(d))
										if d < mi and U.toLine(base[ind],{base[j],U.mod(j+1,base)}) > small_dist then
								if imi then
				--									U.dump(incorner,'??^^^^^^^^^^^^^^^^^ for_IMI:'..imi..':'..tostring(base[imi])..':'..#incorner..' perp:'..tostring(v))
									local x,y = U.lineCross(base[ind],base[ind]+v, base[imi],U.mod(imi+1,base))
								if imi then
				--									U.dump(incorner,'??^^^^^^^^^^^^^^^^^ for_IMI:'..imi..':'..tostring(base[imi])..':'..#incorner..' perp:'..tostring(v))
									local x,y = U.lineCross(base[ind],base[ind]+v, base[imi],U.mod(imi+1,base))
									local ihit
					--                    lo('?? if_HITe:'.. tostring(v)..':'..tostring((v-base[imi]):length())..':'..(v-U.mod(imi+1,base)):length())
									if (v-base[imi]):length() < small_dist or (v-U.mod(imi+1,base)):length() < small_dist then
									local ihit
					--                    lo('?? if_HITe:'.. tostring(v)..':'..tostring((v-base[imi]):length())..':'..(v-U.mod(imi+1,base)):length())
									if (v-base[imi]):length() < small_dist or (v-U.mod(imi+1,base)):length() < small_dist then
							U.dump(map,'?? map:'..ind)
								U.dump(pair,'??^^^^^^^^^^^^^^^^ V_drag:'..tostring(ang)..':'..tostring(v)..':'..tostring(u1))
							U.dump(map,'?? map:'..ind)
								U.dump(pair,'??^^^^^^^^^^^^^^^^ V_drag:'..tostring(ang)..':'..tostring(v)..':'..tostring(u1))
							U.dump(map,'?? map:'..ind)
								U.dump(pair,'??^^^^^^^^^^^^^^^^ V_drag:'..tostring(ang)..':'..tostring(v)..':'..tostring(u1))
				db = cedit.cval['DragPos'].inalong*db:dot(cedit.cval['DragPos'].inalong)
					lo('?? ALONG:'..tostring(db))
		--              _dbdrag = true
	--                db = vec3(0,1,0)
	--                lo('?? for_db:'..tostring(db), true)
	--                U.dump(out.acorner, '??++++++++++++++ for_acorner:')
	--                        if db:length() > 0 then
	--                            lo('??^^^^^^^^^^^^ base_UPDATE: baselen:'..#base..':'..tostring(U.mod(e.ij[2],#base))..' base:'..tostring(U.mod(e.ij[2],base))..' db:'..tostring(db)..':'..tostring(cedit.cval['DragPos'].insplit),true)
	--                        end
	--                        if db:length() > 0 then
	--                            lo('??^^^^^^^^^^^^ base_UPDATE: baselen:'..#base..':'..tostring(U.mod(e.ij[2],#base))..' base:'..tostring(U.mod(e.ij[2],base))..' db:'..tostring(db)..':'..tostring(cedit.cval['DragPos'].insplit),true)
	--                        end
	--                        if db:length() > 0 then
	--                            lo('??^^^^^^^^^^^^ base_UPDATE: baselen:'..#base..':'..tostring(U.mod(e.ij[2],#base))..' base:'..tostring(U.mod(e.ij[2],base))..' db:'..tostring(db)..':'..tostring(cedit.cval['DragPos'].insplit),true)
	--                        end
	--                        if db:length() > 0 then
	--                            lo('??^^^^^^^^^^^^ base_UPDATE: baselen:'..#base..':'..tostring(U.mod(e.ij[2],#base))..' base:'..tostring(U.mod(e.ij[2],base))..' db:'..tostring(db)..':'..tostring(cedit.cval['DragPos'].insplit),true)
	--                        end
					end
	--                    U.dump(cedit.cval['DragPos'].insplit, '?? for_SPLIT:'..tostring(pairend)..':'..tostring(editor.keyModifiers.ctrl))
					if editor.keyModifiers.ctrl then
					end
	--                    U.dump(cedit.cval['DragPos'].insplit, '?? for_SPLIT:'..tostring(pairend)..':'..tostring(editor.keyModifiers.ctrl))
					if editor.keyModifiers.ctrl then
					if editor.keyModifiers.ctrl then
--                U.dump(cedit.cval['DragPos'].insplit,'?? if_SPLIT:'..tostring(pairend))
--						if pairend then
	--                                lo('?? for_PAIRS:'..s.floor..':'..#apair,true)
	--                                lo('?? newpos:'..tostring(vc))
							end
			if not cedit.cval['DragPos'] then
				lo('?? Z-drag:') --..tostring(cameraMouseRayCast(true).object.name), true)
				cedit.cval['DragPos'] = {
			local ds = cameraMouseRayCast(true).pos - smouse
				lo('?? Z_dragging:'..tostring(ds)) --..':'..tostring(cameraMouseRayCast(true).object.name), true)
			adesc[cedit.mesh].pos = cedit.cval['DragPos'].pos + ds:dot(vec3(0,0,1))*vec3(0,0,1)
			local ds = cameraMouseRayCast(true).pos - smouse
				lo('?? Z_dragging:'..tostring(ds)) --..':'..tostring(cameraMouseRayCast(true).object.name), true)
			adesc[cedit.mesh].pos = cedit.cval['DragPos'].pos + ds:dot(vec3(0,0,1))*vec3(0,0,1)
	elseif not cedit.forest and not incorner and not editor.keyModifiers.shift and not editor.keyModifiers.ctrl and not editor.keyModifiers.alt then
--            lo('?? indrag1:'..scope..':'..tostring(cedit.cval['DragPos'])..':'..tostring(rayCast.object.name))
--            if true then return end
	elseif not cedit.forest and not incorner and not editor.keyModifiers.shift and not editor.keyModifiers.ctrl and not editor.keyModifiers.alt then
--            lo('?? indrag1:'..scope..':'..tostring(cedit.cval['DragPos'])..':'..tostring(rayCast.object.name))
--            if true then return end
		local desc = adesc[cedit.mesh]
--			U.dump(desc.selection,'?? drag_free:'..tostring(desc)..':'..tostring(desc.selection)..':'..tableSize(desc.selection))
		if desc and desc.selection and scope=='wall' and tableSize(desc.selection)==1 then
		local desc = adesc[cedit.mesh]
--			U.dump(desc.selection,'?? drag_free:'..tostring(desc)..':'..tostring(desc.selection)..':'..tableSize(desc.selection))
		if desc and desc.selection and scope=='wall' and tableSize(desc.selection)==1 then
						local s = desc.aspline[i][key]
--						lo('?? mdrag_free:'..key..':'..tostring(smouse)..':'..tostring(s))
						local a,b = smouse,cameraMouseRayCast(false).pos
						local s = desc.aspline[i][key]
--						lo('?? mdrag_free:'..key..':'..tostring(smouse)..':'..tostring(s))
						local a,b = smouse,cameraMouseRayCast(false).pos
			if rayCast then
	--            lo('?? drag_pos:'..cameraMouseRayCast(false, im.flags(SOTTerrain)).object.name..':'..cameraMouseRayCast().object.name..':'..tostring(rayCast.pos)..':'..tostring(smouse)..':'..tostring(adesc[cedit.mesh].pos))
				if not cedit.cval['DragPos'] or not cedit.cval['DragPos'].pos then
			if rayCast then
	--            lo('?? drag_pos:'..cameraMouseRayCast(false, im.flags(SOTTerrain)).object.name..':'..cameraMouseRayCast().object.name..':'..tostring(rayCast.pos)..':'..tostring(smouse)..':'..tostring(adesc[cedit.mesh].pos))
				if not cedit.cval['DragPos'] or not cedit.cval['DragPos'].pos then
			if rayCast then
	--            lo('?? drag_pos:'..cameraMouseRayCast(false, im.flags(SOTTerrain)).object.name..':'..cameraMouseRayCast().object.name..':'..tostring(rayCast.pos)..':'..tostring(smouse)..':'..tostring(adesc[cedit.mesh].pos))
				if not cedit.cval['DragPos'] or not cedit.cval['DragPos'].pos then
				end
--                    lo('?? for_build:'..tostring(cedit.cval['DragPos'].pos))
				adesc[cedit.mesh].pos = cedit.cval['DragPos'].pos + (rayCast.pos - smouse)
			local side = forSide()
				U.dump(side, '?? SIDE:'..tostring(cij))
			for i,f in pairs(side) do
			local vh = c2 - (c1 + vz)
--                lo('?? for_WALL:'..tostring(c2 - c1)..':'..tostring(vh), true) --..':'..tostring(smouse), true)
			out.ahole = {c1}
			local vh = c2 - (c1 + vz)
--                lo('?? for_WALL:'..tostring(c2 - c1)..':'..tostring(vh), true) --..':'..tostring(smouse), true)
			out.ahole = {c1}
			local vh = c2 - (c1 + vz)
--                lo('?? for_WALL:'..tostring(c2 - c1)..':'..tostring(vh), true) --..':'..tostring(smouse), true)
			out.ahole = {c1}
				local dv = cterrain * dirhit - cedit.cval['Drag'].terrain
					lo('?? dv:'..tostring(dirhit)..':'..tostring(dv))
				for ord,m in pairs(dmesh[cmesh].data) do
				local dv = cterrain * dirhit - cedit.cval['Drag'].terrain
					lo('?? dv:'..tostring(dirhit)..':'..tostring(dv))
				for ord,m in pairs(dmesh[cmesh].data) do
			-- mesh faces selection
	--            lo('?? Z_DRAG:'..tostring(cmesh))
	--                lo('?? mark:'..tostring(im.GetMousePos())..':'..tostring(rayCast.normal)..':'..tostring(core_camera.getForward()))
	--            lo('?? Z_DRAG:'..tostring(cmesh))
	--                lo('?? mark:'..tostring(im.GetMousePos())..':'..tostring(rayCast.normal)..':'..tostring(core_camera.getForward()))
	--        if true then return end
	--            lo('?? Z_DRAG:'..tostring(cmesh))
	--                lo('?? mark:'..tostring(im.GetMousePos())..':'..tostring(rayCast.normal)..':'..tostring(core_camera.getForward()))
	--        if true then return end
	--            lo('?? Z_DRAG:'..tostring(cmesh))
	--                lo('?? mark:'..tostring(im.GetMousePos())..':'..tostring(rayCast.normal)..':'..tostring(core_camera.getForward()))
	--        if true then return end
	--        if true then return end
	--                lo('?? mark2:'..tostring(dirhit)..':'..tostring(rayCast.normal))
	--        local vx = core_camera.getForward():cross(vec3(0,0,1))
	--        if true then return end
	--                lo('?? mark2:'..tostring(dirhit)..':'..tostring(rayCast.normal))
	--        local vx = core_camera.getForward():cross(vec3(0,0,1))
				local afaces = {}
					lo('?? z_drag:'..tostring(cmesh)) --..':'..#dmesh[cmesh].data..':'..#dmesh[cmesh].buf..':'..tostring(dmesh))
				if cmesh == nil then return end
				local afaces = {}
					lo('?? z_drag:'..tostring(cmesh)) --..':'..#dmesh[cmesh].data..':'..#dmesh[cmesh].buf..':'..tostring(dmesh))
				if cmesh == nil then return end
			local frame = {cedit.cval['Drag_Z'].dragstart - w/2, dr:dot(vx)*vx, dr:dot(vz)*vz, w}
	--                lo('?? for_frame:'..tostring(dirface)..':'..tostring(vx))
	--                out.apoint = {cedit.cval['Drag_Z'][1]}
			local frame = {cedit.cval['Drag_Z'].dragstart - w/2, dr:dot(vx)*vx, dr:dot(vz)*vz, w}
	--                lo('?? for_frame:'..tostring(dirface)..':'..tostring(vx))
	--                out.apoint = {cedit.cval['Drag_Z'][1]}
			inCube(cmesh, frame)
	--                lo('?? zDRAG:'..tostring(#out.apoint))
			out.frame = frame
	if false and editor.keyModifiers.alt and U._PRD == 0 then
--                lo('?? drCtl:'..tostring(ccenter))
		-- fly around
		local newdir = U.vturn(dir, -dx/1000)
--        lo('?? around:'..dx..':'..tostring(core_camera.getForward())..':'..tostring(newdir:normalized())) --..':'..tostring(im.GetMousePos().x))
		local newpos = ccenter - newdir
		local newdir = U.vturn(dir, -dx/1000)
--        lo('?? around:'..dx..':'..tostring(core_camera.getForward())..':'..tostring(newdir:normalized())) --..':'..tostring(im.GetMousePos().x))
		local newpos = ccenter - newdir
		local newdir = U.vturn(dir, -dx/1000)
--        lo('?? around:'..dx..':'..tostring(core_camera.getForward())..':'..tostring(newdir:normalized())) --..':'..tostring(im.GetMousePos().x))
		local newpos = ccenter - newdir
		core_camera.setRotation(0, quatFromDir(newdir, vec3(0,0,1)))
--        lo('?? around:'..tostring(indrag))
		return
	elseif editor.keyModifiers.ctrl then
            lo('?? drag_CTRL:'..tostring(cij)..':'..tostring(cedit.cval['DragRot']),true)
		if adesc[cedit.mesh] == nil then return end
	elseif editor.keyModifiers.ctrl then
            lo('?? drag_CTRL:'..tostring(cij)..':'..tostring(cedit.cval['DragRot']),true)
		if adesc[cedit.mesh] == nil then return end
--        cmouse = ray.pos + d*ray.dir
--            lo('??^^^^^^^^^^^^^^^^^^^^ ctrl_DRAG:'..tostring(cedit.cval['DragRot']))
--            _dbdrag = true
        lo('?? drag_CTRL_0:',true)
--				U.dump(desc.afloor[cij[1]].base, '??+++++++ ROTATE:'..tostring(incorner)..':'..tostring(cedit.mesh)..':'..tostring(ccenter)..':'..tostring(adesc[cedit.mesh])..':'..tostring(desc.afloor[2].ij)..':'..scope..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--                _dbdrag = true
        lo('?? drag_CTRL_0:',true)
--				U.dump(desc.afloor[cij[1]].base, '??+++++++ ROTATE:'..tostring(incorner)..':'..tostring(cedit.mesh)..':'..tostring(ccenter)..':'..tostring(adesc[cedit.mesh])..':'..tostring(desc.afloor[2].ij)..':'..scope..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--                _dbdrag = true
        lo('?? drag_CTRL_0:',true)
--				U.dump(desc.afloor[cij[1]].base, '??+++++++ ROTATE:'..tostring(incorner)..':'..tostring(cedit.mesh)..':'..tostring(ccenter)..':'..tostring(adesc[cedit.mesh])..':'..tostring(desc.afloor[2].ij)..':'..scope..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--                _dbdrag = true
        lo('?? drag_CTRL_0:',true)
--				U.dump(desc.afloor[cij[1]].base, '??+++++++ ROTATE:'..tostring(incorner)..':'..tostring(cedit.mesh)..':'..tostring(ccenter)..':'..tostring(adesc[cedit.mesh])..':'..tostring(desc.afloor[2].ij)..':'..scope..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--                _dbdrag = true
        lo('?? drag_CTRL_0:',true)
--				U.dump(desc.afloor[cij[1]].base, '??+++++++ ROTATE:'..tostring(incorner)..':'..tostring(cedit.mesh)..':'..tostring(ccenter)..':'..tostring(adesc[cedit.mesh])..':'..tostring(desc.afloor[2].ij)..':'..scope..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--                _dbdrag = true
        lo('?? drag_CTRL_0:',true)
--				U.dump(desc.afloor[cij[1]].base, '??+++++++ ROTATE:'..tostring(incorner)..':'..tostring(cedit.mesh)..':'..tostring(ccenter)..':'..tostring(adesc[cedit.mesh])..':'..tostring(desc.afloor[2].ij)..':'..scope..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--                _dbdrag = true
        lo('?? drag_CTRL_0:',true)
--				U.dump(desc.afloor[cij[1]].base, '??+++++++ ROTATE:'..tostring(incorner)..':'..tostring(cedit.mesh)..':'..tostring(ccenter)..':'..tostring(adesc[cedit.mesh])..':'..tostring(desc.afloor[2].ij)..':'..scope..' cij:'..tostring(cij[1])..':'..tostring(cij[2]))
--                _dbdrag = true
				cedit.cval['DragRot'].u = (desc.afloor[cij[1]].base[2] - desc.afloor[cij[1]].base[1]):normalized()
					lo('??+++++++++++++++++++ dir_INI:'..tostring(cedit.cval['DragRot'].u)..':'..tostring(cij[1])..':'..tostring(cij[2]), true)
			end
				cedit.cval['DragRot'].u = (desc.afloor[cij[1]].base[2] - desc.afloor[cij[1]].base[1]):normalized()
					lo('??+++++++++++++++++++ dir_INI:'..tostring(cedit.cval['DragRot'].u)..':'..tostring(cij[1])..':'..tostring(cij[2]), true)
			end
				cedit.cval['DragRot'].u = (desc.afloor[cij[1]].base[2] - desc.afloor[cij[1]].base[1]):normalized()
					lo('??+++++++++++++++++++ dir_INI:'..tostring(cedit.cval['DragRot'].u)..':'..tostring(cij[1])..':'..tostring(cij[2]), true)
			end
			end
--          lo('?? if_corner0:'..tostring(incorner),true)
			local pairend,pair,imap = W.ifPairEnd() --nil,true)
			local pairend,pair,imap = W.ifPairEnd() --nil,true)
--                    U.dump(incorner, '?? if_PAIR:'..tostring(pairend)..':'..tostring(incorner))
--          lo('?? if_corner:'..tostring(pairend),true)
			local pairend,pair,imap = W.ifPairEnd() --nil,true)
--                    U.dump(incorner, '?? if_PAIR:'..tostring(pairend)..':'..tostring(incorner))
--          lo('?? if_corner:'..tostring(pairend),true)
--                    U.dump(incorner, '?? if_PAIR:'..tostring(pairend)..':'..tostring(incorner))
--          lo('?? if_corner:'..tostring(pairend),true)
--					U.dump(incorner, '??_________ PE:'..tostring(pairend))
--          lo('?? if_corner:'..tostring(pairend),true)
--					U.dump(incorner, '??_________ PE:'..tostring(pairend))
			if pairend then
--				cedit.cval['DragRot'].dir = (U.mod(pair[1]+1,cbase)-U.mod(pair[1],cbase)):normalized()
--					U.dump(incorner, '?? if_PE0:'..tostring(pairend)..' dir:'..tostring(cedit.cval['DragRot'].dir),true)
--[[
--				cedit.cval['DragRot'].dir = (U.mod(pair[1]+1,cbase)-U.mod(pair[1],cbase)):normalized()
--					U.dump(incorner, '?? if_PE0:'..tostring(pairend)..' dir:'..tostring(cedit.cval['DragRot'].dir),true)
--[[
				local d = intersectsRay_Plane(ray.pos, ray.dir, p, vn)
					U.dump(wall, '?? for_wall:'..tostring(p)..' d:'..tostring(d))
				cedit.cval['DragRot'].smouse = ray.pos + d*ray.dir
				local d = intersectsRay_Plane(ray.pos, ray.dir, p, vn)
					U.dump(wall, '?? for_wall:'..tostring(p)..' d:'..tostring(d))
				cedit.cval['DragRot'].smouse = ray.pos + d*ray.dir
		local pe = cedit.cval['DragRot'].pairend
			lo('?? if_PE:'..tostring(pe)..':'..tostring(incorner)..':'..tostring(out.acorner)..':'..tostring(cedit.cval['DragRot'])..':'..cij[2], true)
		local toupdate = true
		local pe = cedit.cval['DragRot'].pairend
			lo('?? if_PE:'..tostring(pe)..':'..tostring(incorner)..':'..tostring(out.acorner)..':'..tostring(cedit.cval['DragRot'])..':'..cij[2], true)
		local toupdate = true
		local pe = cedit.cval['DragRot'].pairend
			lo('?? if_PE:'..tostring(pe)..':'..tostring(incorner)..':'..tostring(out.acorner)..':'..tostring(cedit.cval['DragRot'])..':'..cij[2], true)
		local toupdate = true
		local pe = cedit.cval['DragRot'].pairend
			lo('?? if_PE:'..tostring(pe)..':'..tostring(incorner)..':'..tostring(out.acorner)..':'..tostring(cedit.cval['DragRot'])..':'..cij[2], true)
		local toupdate = true
									if m == ij[2] then
--                                        lo('?? to_move_CHILD1:'..k..':'..tostring(c.base[k]))
										c.base[k] = base[ij[2]]
									elseif m == U.mod(ij[2]+1,#base) then
--                                        lo('?? to_move_CHILD2:'..k..':'..tostring(c.base[k]))
										c.base[k] = U.mod(ij[2]+1,base)
--			elseif pe == 1 and incorner then
              U.dump(incorner,'??^^^^^^^^^^^^^^^^^ PE_1:'..tostring(dpos)..':'..tostring(isperp)..' ifit:'..pe,true)
--              _dbdrag = true
--			elseif pe == 1 and incorner then
              U.dump(incorner,'??^^^^^^^^^^^^^^^^^ PE_1:'..tostring(dpos)..':'..tostring(isperp)..' ifit:'..pe,true)
--              _dbdrag = true
--                local cfloor
--                    lo('?? if_ME:'..tostring(cedit.cval['DragRot'].dir)..':'..tostring(dpos))
				if dpos then
--                local cfloor
--                    lo('?? if_ME:'..tostring(cedit.cval['DragRot'].dir)..':'..tostring(dpos))
				if dpos then
					local ang = U.vang(dpos, cedit.cval['DragRot'].dir)
--                        lo('?? pe_EDGE:'..incorner[1].ij[2]..' ang:'..tostring(ang)..' dp:'..tostring(dpos))
					if isperp then
					local ang = U.vang(dpos, cedit.cval['DragRot'].dir)
--                        lo('?? pe_EDGE:'..incorner[1].ij[2]..' ang:'..tostring(ang)..' dp:'..tostring(dpos))
					if isperp then
						local ds = cedit.cval['DragRot'].dir*dpos:dot(cedit.cval['DragRot'].dir)
                lo('?? for_ds:'..tostring(ds)..':'..tostring(dpos),true)
						forBuilding(desc, function(w, ij)
						local ds = cedit.cval['DragRot'].dir*dpos:dot(cedit.cval['DragRot'].dir)
                lo('?? for_ds:'..tostring(ds)..':'..tostring(dpos),true)
						forBuilding(desc, function(w, ij)
								if c.ij[1] == ij[1] and c.ij[2] == ij[2] then
--                                    lo('?? corner_MOVE:'..tostring(ij[2]))
--        elseif incorner then
--            U.dump(incorner, '?? drag_for_V:'..tostring(incorner))
		elseif false and U._PRD == 0 then
		if not cedit.cval['DragPos'] then
--            lo('?? FOREST:'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
		if not cedit.cval['DragPos'] then
--            lo('?? FOREST:'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
		if not cedit.cval['DragPos'] then
--            lo('?? FOREST:'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
			lo('?? FOREST:'..tostring(cedit.cval['DragPos'].mouse), true) --..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
--            smouse = rayCast.pos
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
			lo('?? FOREST:'..tostring(cedit.cval['DragPos'].mouse), true) --..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
--            smouse = rayCast.pos
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
			lo('?? FOREST:'..tostring(cedit.cval['DragPos'].mouse), true) --..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
--            smouse = rayCast.pos
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
			lo('?? FOREST:'..tostring(cedit.cval['DragPos'].mouse), true) --..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
--            smouse = rayCast.pos
		local ds = rayCast.pos - smouse
--            lo('?? FOREST_moving:'..tostring(ds)..':'..tostring(smouse), true)
--                ds = vec3(0,0,0)
		local ds = rayCast.pos - smouse
--            lo('?? FOREST_moving:'..tostring(ds)..':'..tostring(smouse), true)
--                ds = vec3(0,0,0)
				end
--                        lo('?? FOREST2:'..tostring(ds)..':'..U.stamp(ij))
				if dir == 'z' then
			end)
--                lo('?? m4:'..tostring(wdesc)..':'..tostring(cedit.mesh),true)
			houseUp(adesc[cedit.mesh], cedit.mesh, true)
			end)
--                lo('?? m4:'..tostring(wdesc)..':'..tostring(cedit.mesh),true)
			houseUp(adesc[cedit.mesh], cedit.mesh, true)
			houseUp(adesc[cedit.mesh], cedit.mesh, true)
--                    lo('?? fofor:'..tostring(cedit.forest))
			if wdesc then
			if wdesc then
--                lo('?? pre_mark:'..tostring(cedit.mesh),true)
				markUp(wdesc.win)
--                rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
--                lo('?? move floor:'..tostring(camDir)..':'..dx..':'..dy..':'..tostring(ds)..':'..tostring(rayCast.pos))
				local wall = floor.awall[cij[2]]
--                rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
--                lo('?? move floor:'..tostring(camDir)..':'..dx..':'..dy..':'..tostring(ds)..':'..tostring(rayCast.pos))
				local wall = floor.awall[cij[2]]
--                rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
--                lo('?? move floor:'..tostring(camDir)..':'..dx..':'..dy..':'..tostring(ds)..':'..tostring(rayCast.pos))
				local wall = floor.awall[cij[2]]
					local dpos, cmouse = mouseDir(u, v)
	--                    lo('?? for_dpos:'..tostring(dpos),true)
	--                    dpos = vec3(0,0,0)
--                    indrag = false
--            U.dump(cij, '>> forStick:'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(scope))
	local function vert2edge(a, base)
--                    indrag = false
--            U.dump(cij, '>> forStick:'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(scope))
	local function vert2edge(a, base)
--                    indrag = false
--            U.dump(cij, '>> forStick:'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(scope))
	local function vert2edge(a, base)
	local function vert2edge(a, base)
--            lo('>> vert2edge:'..tostring(a))
		local dmi,bmi = near_dist
				bmi = base[k] + (U.mod(k+1,base) - base[k])*s
					lo('?? vert2edge:'..k..':'..tostring(bmi)..'/'..tostring(a)..':'..d)
--                    imi = j
				bmi = base[k] + (U.mod(k+1,base) - base[k])*s
					lo('?? vert2edge:'..k..':'..tostring(bmi)..'/'..tostring(a)..':'..d)
--                    imi = j
		end
			lo('<< vert2edge:'..tostring(a))
		return bmi,dmi
						for k,v in pairs(ashift) do
								lo('?? if diff:'..i1..':'..i2..':'..k..':'..U.vang(v, b-a)..':'..tostring(U.vang(v, b-a) % math.pi))
							isperp = false
			end
				lo('?? for_CHILD:'..tostring(desc.pos)..':'..tostring(floor.base[1])..':'..tostring(floor.pos))
			floorpre = adesc[desc.prn].afloor[desc.floor-1]
			end
				lo('?? for_CHILD:'..tostring(desc.pos)..':'..tostring(floor.base[1])..':'..tostring(floor.pos))
			floorpre = adesc[desc.prn].afloor[desc.floor-1]
			end
				lo('?? for_CHILD:'..tostring(desc.pos)..':'..tostring(floor.base[1])..':'..tostring(floor.pos))
			floorpre = adesc[desc.prn].afloor[desc.floor-1]
			floorpre = adesc[desc.prn].afloor[desc.floor-1]
	--                        lo('?? for_CHILD2:'..tostring(floorpre.pos))
			a,b = forNear(floor, floorpre, desc)
]]
	--                        lo('?? ifhit:'..tostring(a))
		end
		floor = desc.afloor[cij[1]]
			lo('?? for_floor:'..tostring(floor.pos), true)
		if cij[1] > 1 then
			local cd = forVert(floor.base[ij[2]])
--                log('?? for_v:'..tostring(floor.base[ij[2]])..':'..cd)
			if cd < dmi then
		end)
--                lo('?? ab:'..tostring(a)..':'..tostring(b))
--        return
		end)
--                lo('?? ab:'..tostring(a)..':'..tostring(b))
--        return
			if b then
--                    lo('?? to_stick:'..tostring(b)..':'..tostring(a))
				floor.base[cij[2]] = floor.base[cij[2]] + (b - a)
			if b then
--                    lo('?? to_stick:'..tostring(b)..':'..tostring(a))
				floor.base[cij[2]] = floor.base[cij[2]] + (b - a)
--    out.inhole = false
	 	lo('>> mup:'..tostring(W.ui.injunction)..':'..tostring(out.inroad)..':'..tostring(indrag)..' cfor:'..tostring(cedit.forest)..' afor:'..tostring(#cedit.aforest))
--		U.dump(adesc[cedit.mesh].selection, '??+++++++++++++++++ mup.if_SELECTION:')
--    out.inhole = false
	 	lo('>> mup:'..tostring(W.ui.injunction)..':'..tostring(out.inroad)..':'..tostring(indrag)..' cfor:'..tostring(cedit.forest)..' afor:'..tostring(#cedit.aforest))
--		U.dump(adesc[cedit.mesh].selection, '??+++++++++++++++++ mup.if_SELECTION:')
--    out.inhole = false
	 	lo('>> mup:'..tostring(W.ui.injunction)..':'..tostring(out.inroad)..':'..tostring(indrag)..' cfor:'..tostring(cedit.forest)..' afor:'..tostring(#cedit.aforest))
--		U.dump(adesc[cedit.mesh].selection, '??+++++++++++++++++ mup.if_SELECTION:')
--    out.inhole = false
	 	lo('>> mup:'..tostring(W.ui.injunction)..':'..tostring(out.inroad)..':'..tostring(indrag)..' cfor:'..tostring(cedit.forest)..' afor:'..tostring(#cedit.aforest))
--		U.dump(adesc[cedit.mesh].selection, '??+++++++++++++++++ mup.if_SELECTION:')
--    out.inhole = false
	 	lo('>> mup:'..tostring(W.ui.injunction)..':'..tostring(out.inroad)..':'..tostring(indrag)..' cfor:'..tostring(cedit.forest)..' afor:'..tostring(#cedit.aforest))
--		U.dump(adesc[cedit.mesh].selection, '??+++++++++++++++++ mup.if_SELECTION:')
--[[
		lo('?? if_corner:'..tostring(incorner))
]]
	end
--            lo('?? mup.if_control:'..tostring(incontrol), true)
	local sindrag = indrag
	if incontrol then
--            lo('?? mup_if_pull:'..W.ui.wall_pull..':'..tostring(incontrol))
		if incontrol == 'wall_pull' then
]]
					lo('>> mup_backup:'..#asave..':'..tostring(cedit.forest)..':'..tostring(out.inseed))
--                    incontrol = 7
]]
					lo('>> mup_backup:'..#asave..':'..tostring(cedit.forest)..':'..tostring(out.inseed))
--                    incontrol = 7
	if sindrag then
			lo('?? if_prn_drag:'..tostring(cedit.mesh))
		local geodef
--							ang = math.pi/2
--						lo('?? for_DIRS:'..tostring(U.mod(ij[2]-1, awall).u)..':'..tostring(w.u))
					if math.abs(ang - math.pi/2) > small_ang then
--							ang = math.pi/2
--						lo('?? for_DIRS:'..tostring(U.mod(ij[2]-1, awall).u)..':'..tostring(w.u))
					if math.abs(ang - math.pi/2) > small_ang then
									ds = d*(U.vturn(b - U.mod(j+1,baseb),math.pi/2)):normalized()
										lo('?? stick_to_edge:'..i..':'..j..':'..tostring(v))
									d = dmi
			if desc.prn then
					lo('?? for_CHILD:'..tostring(desc.prn)..':'..tostring(desc.floor))
				local dtgt = adesc[desc.prn]
			if desc.prn then
					lo('?? for_CHILD:'..tostring(desc.prn)..':'..tostring(desc.floor))
				local dtgt = adesc[desc.prn]
				ds = forNear(sfloor.base,tfloor.base,sfloor.pos+desc.pos,tfloor.pos)
					U.dump(tfloor.base,'?? ds:'..tostring(ds)..':'..tostring(sfloor.pos)..':'..tostring(tfloor.pos)..':'..tostring(desc.pos))
			elseif scope == 'floor' then
				ds = forNear(sfloor.base,tfloor.base,sfloor.pos+desc.pos,tfloor.pos)
					U.dump(tfloor.base,'?? ds:'..tostring(ds)..':'..tostring(sfloor.pos)..':'..tostring(tfloor.pos)..':'..tostring(desc.pos))
			elseif scope == 'floor' then
				ds = forNear(sfloor.base,tfloor.base,sfloor.pos+desc.pos,tfloor.pos)
					U.dump(tfloor.base,'?? ds:'..tostring(ds)..':'..tostring(sfloor.pos)..':'..tostring(tfloor.pos)..':'..tostring(desc.pos))
			elseif scope == 'floor' then
				ds = forNear(sfloor.base,tfloor.base,sfloor.pos+desc.pos,tfloor.pos)
					U.dump(tfloor.base,'?? ds:'..tostring(ds)..':'..tostring(sfloor.pos)..':'..tostring(tfloor.pos)..':'..tostring(desc.pos))
			elseif scope == 'floor' then
			elseif scope == 'floor' then
					lo('?? for_FLOOR:'..tostring(sfloor.pos)..':'..tostring(tfloor.pos))
				ds = forNear(sfloor.base,tfloor.base,sfloor.pos,tfloor.pos)
			elseif scope == 'floor' then
					lo('?? for_FLOOR:'..tostring(sfloor.pos)..':'..tostring(tfloor.pos))
				ds = forNear(sfloor.base,tfloor.base,sfloor.pos,tfloor.pos)
				ds = forNear(sfloor.base,tfloor.base,sfloor.pos,tfloor.pos)
--                    lo('?? is_NEAR:'..tostring(ds))
			end
			end
--                lo('?? for_DROP:'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(scope), true)
		end
			end
--                lo('?? for_DROP:'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(scope), true)
		end
			end
--                lo('?? for_DROP:'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(scope), true)
		end
	if indrag then
			U.dump(cij, '>> mup_post_DRAG:'..tostring(cedit.cval['DragPos']))
		if U._PRD == 0 and cedit.cval['DragPos'] and cedit.cval['DragPos'].hmouse then
			local rc = {}
				U.dump(out.ahole, '??__________ inhole:'..tostring(base2world(adesc[cedit.mesh], cij))..':'..tostring(cw.u))
			for i=1,4 do -- in pairs(out.ahole) do
			local rc = {}
				U.dump(out.ahole, '??__________ inhole:'..tostring(base2world(adesc[cedit.mesh], cij))..':'..tostring(cw.u))
			for i=1,4 do -- in pairs(out.ahole) do
			local cu = (desc.afloor[cij[1]].base[2] - desc.afloor[cij[1]].base[1]):normalized()
				lo('?? mup.DragRot:'..tostring(cedit.cval['DragRot'].u)..':'..tostring(cu), true)
			local ang = U.vang(cedit.cval['DragRot'].u, cu, true) % (2*math.pi)
			local cu = (desc.afloor[cij[1]].base[2] - desc.afloor[cij[1]].base[1]):normalized()
				lo('?? mup.DragRot:'..tostring(cedit.cval['DragRot'].u)..':'..tostring(cu), true)
			local ang = U.vang(cedit.cval['DragRot'].u, cu, true) % (2*math.pi)
			local ang = U.vang(cedit.cval['DragRot'].u, cu, true) % (2*math.pi)
				lo('?? for_ang:'..tostring(ang)..':'..tostring(cedit.cval['DragRot'].center), true)
			for i = 0,8 do
			local ang = U.vang(cedit.cval['DragRot'].u, cu, true) % (2*math.pi)
				lo('?? for_ang:'..tostring(ang)..':'..tostring(cedit.cval['DragRot'].center), true)
			for i = 0,8 do
	local nm = rayCast.object.name
			lo('??******************* mup:'..tostring(scope)..':'..tostring(rayCast.object.shapeName)..':'..tostring(nm)..':'..tostring(scope)..':'..tostring(cedit.mesh), true)
	if rayCast.object.shapeName then
	local nm = rayCast.object.name
			lo('??******************* mup:'..tostring(scope)..':'..tostring(rayCast.object.shapeName)..':'..tostring(nm)..':'..tostring(scope)..':'..tostring(cedit.mesh), true)
	if rayCast.object.shapeName then
	local nm = rayCast.object.name
			lo('??******************* mup:'..tostring(scope)..':'..tostring(rayCast.object.shapeName)..':'..tostring(nm)..':'..tostring(scope)..':'..tostring(cedit.mesh), true)
	if rayCast.object.shapeName then
	local nm = rayCast.object.name
			lo('??******************* mup:'..tostring(scope)..':'..tostring(rayCast.object.shapeName)..':'..tostring(nm)..':'..tostring(scope)..':'..tostring(cedit.mesh), true)
	if rayCast.object.shapeName then
	local nm = rayCast.object.name
			lo('??******************* mup:'..tostring(scope)..':'..tostring(rayCast.object.shapeName)..':'..tostring(nm)..':'..tostring(scope)..':'..tostring(cedit.mesh), true)
	if rayCast.object.shapeName then
	if not nm then
		lo('?? for_path:'..tostring(rayCast.object.shapeName)) --:getField('shapeName')))
--		W.forJSON(rayCast.object.shapeName)
	local id = scenetree.findObject(nm):getID()
			lo('?? for_ID:'..tostring(id)..'/'..tostring(cedit.mesh))
	if scope == 'building' and string.find(nm, 'o_') == 1 and id ~= cedit.mesh and editor.keyModifiers.ctrl then
	local id = scenetree.findObject(nm):getID()
			lo('?? for_ID:'..tostring(id)..'/'..tostring(cedit.mesh))
	if scope == 'building' and string.find(nm, 'o_') == 1 and id ~= cedit.mesh and editor.keyModifiers.ctrl then
--            if string.find(nm, 'o_lid_') == 1 then
--                lo('??___________ if_AF:'..tostring(#desc.afloor[#desc.afloor].top.achild),true)
--            end
				if out.aedge then
							U.dump(out.aedge, '?? for_edge:'..tostring(out.aedge.top))
					if out.inedge and out.inedge[1] == out.aedge.ij[1] and out.inedge[2] == out.aedge.ij[2] then
				elseif out.axis then
		--                    lo('?? axis_HIT:'..tostring())
					if (rayCast.pos - out.axis.pos):length() < 0.4 then
							local desc = adesc[cedit.mesh]
					--                    U.dump(cij, '?? for_cij:'..tostring(desc))
							local cfloor
							end)
									lo('?? flipped:'..scope..':'..tostring(cij[1]))
							houseUp(adesc[cedit.mesh], cedit.mesh, true)
-- split
				U.dump(out.wsplit, '?? for_split_alt:'..tostring(scope)..':'..id..':'..tostring(aedit[id]))
			if aedit[id] then
-- split
				U.dump(out.wsplit, '?? for_split_alt:'..tostring(scope)..':'..id..':'..tostring(aedit[id]))
			if aedit[id] then
				local key = forKey(rayCast)
--					lo('?? forestAPPEND:'..tostring(out.preforest)..':'..tostring(cedit.fscope)..':'..key..':'..tostring(dforest[key]))
				if out.preforest then
				local key = forKey(rayCast)
--					lo('?? forestAPPEND:'..tostring(out.preforest)..':'..tostring(cedit.fscope)..':'..key..':'..tostring(dforest[key]))
				if out.preforest then
				local key = forKey(rayCast)
--					lo('?? forestAPPEND:'..tostring(out.preforest)..':'..tostring(cedit.fscope)..':'..key..':'..tostring(dforest[key]))
				if out.preforest then
	end
		U.dump(ij, '?? mup.for_hit:'..nm..':'..tostring(editor.keyModifiers.ctrl))
	if editor.keyModifiers.ctrl and not sindrag then --and U._MODE ~= 'conf' then
	if editor.keyModifiers.ctrl and not sindrag then --and U._MODE ~= 'conf' then
            lo('?? ifGEN:'..tostring(ij)..':'..tostring(nm)..':'..tostring(out.inroad))
		if not ij and (not out.inroad or out.inroad == 0) then
	if editor.keyModifiers.ctrl and not sindrag then --and U._MODE ~= 'conf' then
            lo('?? ifGEN:'..tostring(ij)..':'..tostring(nm)..':'..tostring(out.inroad))
		if not ij and (not out.inroad or out.inroad == 0) then
	if editor.keyModifiers.ctrl and not sindrag then --and U._MODE ~= 'conf' then
            lo('?? ifGEN:'..tostring(ij)..':'..tostring(nm)..':'..tostring(out.inroad))
		if not ij and (not out.inroad or out.inroad == 0) then
			-- BUILDING gen
				lo('?? to_GEN:'..tostring(W.ui.injunction))
			if W.ui.injunction then
	end
  		lo('?? mup_pre:'..tostring(nm)..'/'..tostring(forestName)..':'..tostring(cedit.mesh)..':'..tostring(cij)) --..' cij:'..cij[1]..':'..cij[2])
--	    local fkey = forKey(rayCast)
	end
  		lo('?? mup_pre:'..tostring(nm)..'/'..tostring(forestName)..':'..tostring(cedit.mesh)..':'..tostring(cij)) --..' cij:'..cij[1]..':'..cij[2])
--	    local fkey = forKey(rayCast)
	end
  		lo('?? mup_pre:'..tostring(nm)..'/'..tostring(forestName)..':'..tostring(cedit.mesh)..':'..tostring(cij)) --..' cij:'..cij[1]..':'..cij[2])
--	    local fkey = forKey(rayCast)
	end
  		lo('?? mup_pre:'..tostring(nm)..'/'..tostring(forestName)..':'..tostring(cedit.mesh)..':'..tostring(cij)) --..' cij:'..cij[1]..':'..cij[2])
--	    local fkey = forKey(rayCast)
--			lo('?? if_KEY:'..fkey)
--  		lo('?? mup_pre:'..tostring(fkey)..':'..':'..tostring(nm)..'/'..tostring(forestName)..':'..tostring(cedit.mesh)..':'..tostring(cij)) --..' cij:'..cij[1]..':'..cij[2])
--    if nm ~= forestName then
--			lo('?? if_KEY:'..fkey)
--  		lo('?? mup_pre:'..tostring(fkey)..':'..':'..tostring(nm)..'/'..tostring(forestName)..':'..tostring(cedit.mesh)..':'..tostring(cij)) --..' cij:'..cij[1]..':'..cij[2])
--    if nm ~= forestName then
--			lo('?? if_KEY:'..fkey)
--  		lo('?? mup_pre:'..tostring(fkey)..':'..':'..tostring(nm)..'/'..tostring(forestName)..':'..tostring(cedit.mesh)..':'..tostring(cij)) --..' cij:'..cij[1]..':'..cij[2])
--    if nm ~= forestName then
--			lo('?? if_KEY:'..fkey)
--  		lo('?? mup_pre:'..tostring(fkey)..':'..':'..tostring(nm)..'/'..tostring(forestName)..':'..tostring(cedit.mesh)..':'..tostring(cij)) --..' cij:'..cij[1]..':'..cij[2])
--    if nm ~= forestName then
--			lo('?? if_KEY:'..fkey)
--  		lo('?? mup_pre:'..tostring(fkey)..':'..':'..tostring(nm)..'/'..tostring(forestName)..':'..tostring(cedit.mesh)..':'..tostring(cij)) --..' cij:'..cij[1]..':'..cij[2])
--    if nm ~= forestName then
--        local rCast = cameraMouseRayCast(false)
--			U.dump(dforest[key], '?? for_forest:'..tostring(scope)..':'..tostring(dforest[key] and dforest[key].type or nil)..':'..tostring(key)..'/'..tostring(cedit.forest)..':'..tostring(cedit.fscope)) --..':'..tostring(rCast.object.name)) --..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.fscope))
		if not key or not dforest[key] then return end
--        local rCast = cameraMouseRayCast(false)
--			U.dump(dforest[key], '?? for_forest:'..tostring(scope)..':'..tostring(dforest[key] and dforest[key].type or nil)..':'..tostring(key)..'/'..tostring(cedit.forest)..':'..tostring(cedit.fscope)) --..':'..tostring(rCast.object.name)) --..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.fscope))
		if not key or not dforest[key] then return end
--        local rCast = cameraMouseRayCast(false)
--			U.dump(dforest[key], '?? for_forest:'..tostring(scope)..':'..tostring(dforest[key] and dforest[key].type or nil)..':'..tostring(key)..'/'..tostring(cedit.forest)..':'..tostring(cedit.fscope)) --..':'..tostring(rCast.object.name)) --..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.fscope))
		if not key or not dforest[key] then return end
--        local rCast = cameraMouseRayCast(false)
--			U.dump(dforest[key], '?? for_forest:'..tostring(scope)..':'..tostring(dforest[key] and dforest[key].type or nil)..':'..tostring(key)..'/'..tostring(cedit.forest)..':'..tostring(cedit.fscope)) --..':'..tostring(rCast.object.name)) --..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.fscope))
		if not key or not dforest[key] then return end
--        local rCast = cameraMouseRayCast(false)
--			U.dump(dforest[key], '?? for_forest:'..tostring(scope)..':'..tostring(dforest[key] and dforest[key].type or nil)..':'..tostring(key)..'/'..tostring(cedit.forest)..':'..tostring(cedit.fscope)) --..':'..tostring(rCast.object.name)) --..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.fscope))
		if not key or not dforest[key] then return end
--        local rCast = cameraMouseRayCast(false)
--			U.dump(dforest[key], '?? for_forest:'..tostring(scope)..':'..tostring(dforest[key] and dforest[key].type or nil)..':'..tostring(key)..'/'..tostring(cedit.forest)..':'..tostring(cedit.fscope)) --..':'..tostring(rCast.object.name)) --..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.fscope))
		if not key or not dforest[key] then return end
--        local rCast = cameraMouseRayCast(false)
--			U.dump(dforest[key], '?? for_forest:'..tostring(scope)..':'..tostring(dforest[key] and dforest[key].type or nil)..':'..tostring(key)..'/'..tostring(cedit.forest)..':'..tostring(cedit.fscope)) --..':'..tostring(rCast.object.name)) --..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.fscope))
		if not key or not dforest[key] then return end
--        local rCast = cameraMouseRayCast(false)
--			U.dump(dforest[key], '?? for_forest:'..tostring(scope)..':'..tostring(dforest[key] and dforest[key].type or nil)..':'..tostring(key)..'/'..tostring(cedit.forest)..':'..tostring(cedit.fscope)) --..':'..tostring(rCast.object.name)) --..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.fscope))
		if not key or not dforest[key] then return end
				local dae = dforest[key].item:getData():getShapeFile()
					lo('?? for_complex_TP:'..dforest[key].type..':'..tostring(dae))
				cedit.forest = key
		end
--			lo('??___***___ if_PREF:'..tostring(out.preforest))
		if key == out.preforest and cedit.fscope and scope == 'wall' then
			cedit.fscope = cedit.fscope - 1
					lo('?? tof1: fscope:'..tostring(cedit.fscope)..':'..tostring(cedit.forest), true)
			if cedit.fscope == 0 then
			cedit.fscope = cedit.fscope - 1
					lo('?? tof1: fscope:'..tostring(cedit.fscope)..':'..tostring(cedit.forest), true)
			if cedit.fscope == 0 then
		elseif not (dforest[key].type == 'door' and scope == 'building') then
				lo('?? tof2:'..key..' fscope:'..tostring(cedit.fscope)..':'..dforest[key].type..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.mesh)..':'..tostring(#cedit.aforest), true)
--                U.dump(dforest[key], '?? tof2:'..dforest[key].type, true)
		elseif not (dforest[key].type == 'door' and scope == 'building') then
				lo('?? tof2:'..key..' fscope:'..tostring(cedit.fscope)..':'..dforest[key].type..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.mesh)..':'..tostring(#cedit.aforest), true)
--                U.dump(dforest[key], '?? tof2:'..dforest[key].type, true)
		elseif not (dforest[key].type == 'door' and scope == 'building') then
				lo('?? tof2:'..key..' fscope:'..tostring(cedit.fscope)..':'..dforest[key].type..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.mesh)..':'..tostring(#cedit.aforest), true)
--                U.dump(dforest[key], '?? tof2:'..dforest[key].type, true)
		elseif not (dforest[key].type == 'door' and scope == 'building') then
				lo('?? tof2:'..key..' fscope:'..tostring(cedit.fscope)..':'..dforest[key].type..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.mesh)..':'..tostring(#cedit.aforest), true)
--                U.dump(dforest[key], '?? tof2:'..dforest[key].type, true)
			cedit.aforest = {}
--          lo('?? ce_f:'..tostring(cedit.forest))
--            local dae = U.forOrig(dforest[key].item:getData():getShapeFile())
				if not tonumber(ij[2]) then
					lo('??^^^^^^^^^^^^^^ from_SPLINE:'..tostring(sij)..':'..tostring(dae))
				end
				if not tonumber(ij[2]) then
					lo('??^^^^^^^^^^^^^^ from_SPLINE:'..tostring(sij)..':'..tostring(dae))
				end
--                    U.dump(w.df[dae], '?? for_key:'..dae)
--                        lo('??_____________________ for_DF:'..tostring(desc.afloor[ij[1]].df))
--                if #U.index(desc.afloor[ij[1]].df[dae], key) > 0 then
					out.curselect = daeIndex('door', dae)
--                    lo('??__________________________ cursel:'..tostring(out.curselect), true)
				end
			end, {}, true)
--                lo('?? found:'..tostring(out.curselect),true)
--				U.dump(daePath[tp],'?? cs:'..tp..':'..tostring(sij)..':'..dae) --..':'..dforest[key].type)
--                lo('?? found:'..tostring(out.curselect),true)
--				U.dump(daePath[tp],'?? cs:'..tp..':'..tostring(sij)..':'..dae) --..':'..dforest[key].type)
--                lo('?? di:'..daeIndex(dforest[key].type, dae))
			markUp(dae)
--          		lo('?? ce_f2:'..tostring(#cedit.aforest))
--				out._dbgcheck = true
    	out.fscope = cedit.fscope
--			lo('??+++++++++++++++++++++++++++++++++++++ for_FSCOPE:'..tostring(out.fscope))
--        if dforest[key] and dforest[key].type == 'balcony' then
		-- start edit
			lo('?? if_edit:'..tostring(cedit.mesh)..':'..tostring(id)..':'..tableSize(adesc))
--      for k,d in pairs(adesc) do
		-- start edit
			lo('?? if_edit:'..tostring(cedit.mesh)..':'..tostring(id)..':'..tableSize(adesc))
--      for k,d in pairs(adesc) do
--      for k,d in pairs(adesc) do
--        lo('?? if_DESC:'..k..':'..tostring(adesc[k]))
--      end
		ij = forHit(ray, adesc[cedit.mesh])
			U.dump(ij, '?? for_desc:'..id..':'..tostring(adesc[id])..':'..tostring(cedit.mesh)..' cursel:'..tostring(out.curselect))
		if ij then
		ij = forHit(ray, adesc[cedit.mesh])
			U.dump(ij, '?? for_desc:'..id..':'..tostring(adesc[id])..':'..tostring(cedit.mesh)..' cursel:'..tostring(out.curselect))
		if ij then
		ij = forHit(ray, adesc[cedit.mesh])
			U.dump(ij, '?? for_desc:'..id..':'..tostring(adesc[id])..':'..tostring(cedit.mesh)..' cursel:'..tostring(out.curselect))
		if ij then
	elseif string.find(nm, 'o_spline_') == 1 and scope == 'wall' then
			lo('?? spline_select:'..tostring(id)..':'..tostring(cedit.forest))
		cedit.foret = nil
	elseif string.find(nm, 'o_spline_') == 1 and scope == 'wall' then
			lo('?? spline_select:'..tostring(id)..':'..tostring(cedit.forest))
		cedit.foret = nil
		local scopenew = scope
			U.dump(ij, '??__________________ mup_SCOPE:'..tostring(scope)..':'..tostring(ij))
--            U.dump(cij, '?? cij:')
		local scopenew = scope
			U.dump(ij, '??__________________ mup_SCOPE:'..tostring(scope)..':'..tostring(ij))
--            U.dump(cij, '?? cij:')
				local ihole = U.inRC(world2wall(rayCast.pos, cw), cw.achild, 'base')
	--                    U.dump(cw.achild, '?? if_HOLE:'..tostring(ihole)..':'..tostring(world2wall(rayCast.pos, cw)))
				if ihole then
				local ihole = U.inRC(world2wall(rayCast.pos, cw), cw.achild, 'base')
	--                    U.dump(cw.achild, '?? if_HOLE:'..tostring(ihole)..':'..tostring(world2wall(rayCast.pos, cw)))
				if ihole then
					for i,p in pairs(cw.achild[ihole].base) do
	--                    lo('?? for_p:'..tostring(cw.pos)..':'..tostring(p)..':'..tostring(cw.u)..':'..tostring(cw.v))
	--                    lo('?? for_p2:'..tostring(vec3(p.x*cw.u:normalized(), p.y*cw.v:normalized(),0)))
					for i,p in pairs(cw.achild[ihole].base) do
	--                    lo('?? for_p:'..tostring(cw.pos)..':'..tostring(p)..':'..tostring(cw.u)..':'..tostring(cw.v))
	--                    lo('?? for_p2:'..tostring(vec3(p.x*cw.u:normalized(), p.y*cw.v:normalized(),0)))
					for i,p in pairs(cw.achild[ihole].base) do
	--                    lo('?? for_p:'..tostring(cw.pos)..':'..tostring(p)..':'..tostring(cw.u)..':'..tostring(cw.v))
	--                    lo('?? for_p2:'..tostring(vec3(p.x*cw.u:normalized(), p.y*cw.v:normalized(),0)))
					for i,p in pairs(cw.achild[ihole].base) do
	--                    lo('?? for_p:'..tostring(cw.pos)..':'..tostring(p)..':'..tostring(cw.u)..':'..tostring(cw.v))
	--                    lo('?? for_p2:'..tostring(vec3(p.x*cw.u:normalized(), p.y*cw.v:normalized(),0)))
	--                    lo('?? for_p:'..tostring(cw.pos)..':'..tostring(p)..':'..tostring(cw.u)..':'..tostring(cw.v))
	--                    lo('?? for_p2:'..tostring(vec3(p.x*cw.u:normalized(), p.y*cw.v:normalized(),0)))
						out.ahole[#out.ahole+1] = cw.pos + p.x*cw.u:normalized() + p.y*cw.v:normalized()
			end
				lo('?? if_ij2:'..ij[1]..':'..tostring(ij[2]))
			if not ij[2] then
				local floor = adesc[cedit.mesh].afloor[cij[1]]
--            lo('?? if_tCHILD:'..tostring(floor and #floor.top.achild or nil))
				if floor and #floor.top.achild > 0 then
					local _,inrc,ichild = forRoofHit(adesc[cedit.mesh], cij[1])
						lo('??++++++++++++++++ mup.RH1:'..tostring(inrc)..':'..tostring(ichild))
					if ichild then
					local _,inrc,ichild = forRoofHit(adesc[cedit.mesh], cij[1])
						lo('??++++++++++++++++ mup.RH1:'..tostring(inrc)..':'..tostring(ichild))
					if ichild then
						for i,c in pairs(floor.top.achild) do
--                            U.dump(c, '?? for_LIST:'..i..':'..inrc..' scch:'..tostring(scchild)..':'..#U.index(c.list, inrc))
							if #U.index(c.list, inrc) > 0 then
					end
						lo('?? inrc:'..tostring(inrc)..':'..tostring(floor.top.cchild)..':'..scopenew)
	--                        U.dump(floor.top.achild, '?? achild:')
					end
						lo('?? inrc:'..tostring(inrc)..':'..tostring(floor.top.cchild)..':'..scopenew)
	--                        U.dump(floor.top.achild, '?? achild:')
			if scope ~= 'top' then
				local cmat = out.curselect and tostring(dmat.wall[out.curselect+1]) or nil
--            lo('?? mup_mat:'..tostring(cmat)..':'..tostring(out.curselect))
				local cmat = out.curselect and tostring(dmat.wall[out.curselect+1]) or nil
--            lo('?? mup_mat:'..tostring(cmat)..':'..tostring(out.curselect))
	--                U.dump(cij, '?? pre_SCOPE:'..scopenew..':'..tostring(out.curselect)..':'..tostring(dmat.wall[out.curselect or 0])..':'..tostring(cmat))
				local cmat = out.curselect and tostring(dmat.wall[out.curselect+1]) or nil
--            lo('?? mup_mat:'..tostring(cmat)..':'..tostring(out.curselect))
	--                U.dump(cij, '?? pre_SCOPE:'..scopenew..':'..tostring(out.curselect)..':'..tostring(dmat.wall[out.curselect or 0])..':'..tostring(cmat))
--            lo('?? mup_mat:'..tostring(cmat)..':'..tostring(out.curselect))
	--                U.dump(cij, '?? pre_SCOPE:'..scopenew..':'..tostring(out.curselect)..':'..tostring(dmat.wall[out.curselect or 0])..':'..tostring(cmat))
				forBuilding(desc, function(w, ij)
--            lo('?? mup_mat:'..tostring(cmat)..':'..tostring(out.curselect))
	--                U.dump(cij, '?? pre_SCOPE:'..scopenew..':'..tostring(out.curselect)..':'..tostring(dmat.wall[out.curselect or 0])..':'..tostring(cmat))
				forBuilding(desc, function(w, ij)
--            lo('?? mup_mat:'..tostring(cmat)..':'..tostring(out.curselect))
	--                U.dump(cij, '?? pre_SCOPE:'..scopenew..':'..tostring(out.curselect)..':'..tostring(dmat.wall[out.curselect or 0])..':'..tostring(cmat))
				forBuilding(desc, function(w, ij)
				forBuilding(desc, function(w, ij)
	--                    lo('?? mat_check:'..tostring(ij[1])..':'..tostring(ij[2])..':'..tostring(w.mat)..':'..tostring(dmat.wall[out.curselect])..':'..tostring(cmat==nil))
					if not cmat then
				forBuilding(desc, function(w, ij)
	--                    lo('?? mat_check:'..tostring(ij[1])..':'..tostring(ij[2])..':'..tostring(w.mat)..':'..tostring(dmat.wall[out.curselect])..':'..tostring(cmat==nil))
					if not cmat then
				forBuilding(desc, function(w, ij)
	--                    lo('?? mat_check:'..tostring(ij[1])..':'..tostring(ij[2])..':'..tostring(w.mat)..':'..tostring(dmat.wall[out.curselect])..':'..tostring(cmat==nil))
					if not cmat then
				forBuilding(desc, function(w, ij)
	--                    lo('?? mat_check:'..tostring(ij[1])..':'..tostring(ij[2])..':'..tostring(w.mat)..':'..tostring(dmat.wall[out.curselect])..':'..tostring(cmat==nil))
					if not cmat then
				forBuilding(desc, function(w, ij)
	--                    lo('?? mat_check:'..tostring(ij[1])..':'..tostring(ij[2])..':'..tostring(w.mat)..':'..tostring(dmat.wall[out.curselect])..':'..tostring(cmat==nil))
					if not cmat then
					if w.mat ~= cmat then
	--                if w.mat ~= tostring(dmat.wall[out.curselect]) then
						matmatch = false
					for i,m in pairs(dmat.wall) do
						if tostring(m) == cmat then
							out.curselect = i-1
		if false and rayCast and not N.out.inseed and not W.ui.injunction then
				lo('?? to_SEED:'..tostring(rayCast.pos))
			N.circleSeed(W.ui.node_n, vec3(rayCast.pos.x, rayCast.pos.y), W.ui.node_r)
	end
		U.dump(cij, '<< mup:'..tostring(scope)..':'..tostring(ij)..':'..tostring(cedit.mesh)..' forest:'..tostring(cedit.forest)..':'..#adesc..' cursel:'..tostring(out.curselect))
	return ij
	end
		U.dump(cij, '<< mup:'..tostring(scope)..':'..tostring(ij)..':'..tostring(cedit.mesh)..' forest:'..tostring(cedit.forest)..':'..#adesc..' cursel:'..tostring(out.curselect))
	return ij
	end
		U.dump(cij, '<< mup:'..tostring(scope)..':'..tostring(ij)..':'..tostring(cedit.mesh)..' forest:'..tostring(cedit.forest)..':'..#adesc..' cursel:'..tostring(out.curselect))
	return ij
	end
		U.dump(cij, '<< mup:'..tostring(scope)..':'..tostring(ij)..':'..tostring(cedit.mesh)..' forest:'..tostring(cedit.forest)..':'..#adesc..' cursel:'..tostring(out.curselect))
	return ij
	end
		U.dump(cij, '<< mup:'..tostring(scope)..':'..tostring(ij)..':'..tostring(cedit.mesh)..' forest:'..tostring(cedit.forest)..':'..#adesc..' cursel:'..tostring(out.curselect))
	return ij
local function mup_(rayCast, inject)
		lo('>> mup_:'..tostring(rayCast)..':'..tostring(indrag), true)
local function mup_(rayCast, inject)
		lo('>> mup_:'..tostring(rayCast)..':'..tostring(indrag), true)
		elseif out.axis then
--                    lo('?? axis_HIT:'..tostring())
			if (rayCast.pos - out.axis.pos):length() < 0.4 then
	local nm = rayCast.object.name
		lo('?? mup0:'..tostring(nm)..':'..tostring(scope)..':'..tostring(indrag)..':'..tostring(cedit.part)..':'..tostring(cmesh)..':'..tostring(Engine.Render.DecalMgr.getDecalInstance(1))) --#Engine.Render.DecalMgr.getSet():getObjects())) --..tostring(editor.getDecalTemplates():size())) --..rayCast.object.name)
	if nm == nil then return end
	local nm = rayCast.object.name
		lo('?? mup0:'..tostring(nm)..':'..tostring(scope)..':'..tostring(indrag)..':'..tostring(cedit.part)..':'..tostring(cmesh)..':'..tostring(Engine.Render.DecalMgr.getDecalInstance(1))) --#Engine.Render.DecalMgr.getSet():getObjects())) --..tostring(editor.getDecalTemplates():size())) --..rayCast.object.name)
	if nm == nil then return end
	local nm = rayCast.object.name
		lo('?? mup0:'..tostring(nm)..':'..tostring(scope)..':'..tostring(indrag)..':'..tostring(cedit.part)..':'..tostring(cmesh)..':'..tostring(Engine.Render.DecalMgr.getDecalInstance(1))) --#Engine.Render.DecalMgr.getSet():getObjects())) --..tostring(editor.getDecalTemplates():size())) --..rayCast.object.name)
	if nm == nil then return end
	local nm = rayCast.object.name
		lo('?? mup0:'..tostring(nm)..':'..tostring(scope)..':'..tostring(indrag)..':'..tostring(cedit.part)..':'..tostring(cmesh)..':'..tostring(Engine.Render.DecalMgr.getDecalInstance(1))) --#Engine.Render.DecalMgr.getSet():getObjects())) --..tostring(editor.getDecalTemplates():size())) --..rayCast.object.name)
	if nm == nil then return end
	local nm = rayCast.object.name
		lo('?? mup0:'..tostring(nm)..':'..tostring(scope)..':'..tostring(indrag)..':'..tostring(cedit.part)..':'..tostring(cmesh)..':'..tostring(Engine.Render.DecalMgr.getDecalInstance(1))) --#Engine.Render.DecalMgr.getSet():getObjects())) --..tostring(editor.getDecalTemplates():size())) --..rayCast.object.name)
	if nm == nil then return end
	local nm = rayCast.object.name
		lo('?? mup0:'..tostring(nm)..':'..tostring(scope)..':'..tostring(indrag)..':'..tostring(cedit.part)..':'..tostring(cmesh)..':'..tostring(Engine.Render.DecalMgr.getDecalInstance(1))) --#Engine.Render.DecalMgr.getSet():getObjects())) --..tostring(editor.getDecalTemplates():size())) --..rayCast.object.name)
	if nm == nil then return end
	local nm = rayCast.object.name
		lo('?? mup0:'..tostring(nm)..':'..tostring(scope)..':'..tostring(indrag)..':'..tostring(cedit.part)..':'..tostring(cmesh)..':'..tostring(Engine.Render.DecalMgr.getDecalInstance(1))) --#Engine.Render.DecalMgr.getSet():getObjects())) --..tostring(editor.getDecalTemplates():size())) --..rayCast.object.name)
	if nm == nil then return end
			local amesh,c,path = M.pop(dmesh[id].data, dmesh[id].sel)
				lo('?? FOR_MESH:'..nm..':'..tostring(id)..':'..tostring(rayCast.pos)..':'..tostring(c))
			if amesh == nil or c == nil then
			local amesh,c,path = M.pop(dmesh[id].data, dmesh[id].sel)
				lo('?? FOR_MESH:'..nm..':'..tostring(id)..':'..tostring(rayCast.pos)..':'..tostring(c))
			if amesh == nil or c == nil then
			local amesh,c,path = M.pop(dmesh[id].data, dmesh[id].sel)
				lo('?? FOR_MESH:'..nm..':'..tostring(id)..':'..tostring(rayCast.pos)..':'..tostring(c))
			if amesh == nil or c == nil then
			if amesh == nil or c == nil then
				lo('!! mup_NOSELECT:'..tostring(amesh))
				return
			core_camera.setSpeed(speed)
				lo('?? UPDTD:'..id) --..':'..tostring(c)..':'..speed)
--                U.dump(dmesh[id].sel[1].ref, '?? for_REF:')
		out.frame = nil
			lo('<< mup_mesh:'..tostring(cmesh))
		return
--                    indrag = false
					lo('?? for_DROP:'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(scope), true)
			local function forNear(floor, floorpre, child)
--                    indrag = false
					lo('?? for_DROP:'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(scope), true)
			local function forNear(floor, floorpre, child)
--                    indrag = false
					lo('?? for_DROP:'..tostring(cedit.mesh)..':'..tostring(cedit.part)..':'..tostring(scope), true)
			local function forNear(floor, floorpre, child)
					end
						lo('?? for_CHILD:'..tostring(desc.pos)..':'..tostring(floor.base[1])..':'..tostring(floor.pos))
					floorpre = adesc[desc.prn].afloor[desc.floor-1]
					end
						lo('?? for_CHILD:'..tostring(desc.pos)..':'..tostring(floor.base[1])..':'..tostring(floor.pos))
					floorpre = adesc[desc.prn].afloor[desc.floor-1]
					end
						lo('?? for_CHILD:'..tostring(desc.pos)..':'..tostring(floor.base[1])..':'..tostring(floor.pos))
					floorpre = adesc[desc.prn].afloor[desc.floor-1]
					floorpre = adesc[desc.prn].afloor[desc.floor-1]
--                        lo('?? for_CHILD2:'..tostring(floorpre.pos))
					a,b = forNear(floor, floorpre, desc)
					a,b = forNear(floor, floorpre, desc)
--                        lo('?? ifhit:'..tostring(a))
				end
				floor = desc.afloor[cij[1]]
--                    lo('?? for_floor:'..tostring(floor.pos), true)
				if cij[1] > 1 then
--                            out.apick = {b}
							lo('?? for_hit:'..tostring(b))
							return
			p.z = 0
	--            U.dump(lastFloor.top.body, '?? mup.floors:'..#adesc[cedit.mesh].afloor..':'..tostring(p))
			local inrc = U.inRC(p, lastFloor.top.body)
			local inrc = U.inRC(p, lastFloor.top.body)
	--            lo('?? INRC:'..tostring(inrc))
			if inrc ~= nil then
		end
--            lo('?? mup_newe:'..tostring(newedit))
		-- check for same
			local key = forKey(rayCast)
				lo('?? mup_forest:'..tostring(newedit)..':'..tostring(indrag)..':'..tostring(key)..'/'..tostring(cedit.forest))
			if editor.keyModifiers.ctrl then
			local key = forKey(rayCast)
				lo('?? mup_forest:'..tostring(newedit)..':'..tostring(indrag)..':'..tostring(key)..'/'..tostring(cedit.forest))
			if editor.keyModifiers.ctrl then
			local key = forKey(rayCast)
				lo('?? mup_forest:'..tostring(newedit)..':'..tostring(indrag)..':'..tostring(key)..'/'..tostring(cedit.forest))
			if editor.keyModifiers.ctrl then
			local key = forKey(rayCast)
				lo('?? mup_forest:'..tostring(newedit)..':'..tostring(indrag)..':'..tostring(key)..'/'..tostring(cedit.forest))
			if editor.keyModifiers.ctrl then
					local desc = adesc[cedit.mesh]
							U.dump(cij, '?? wall_sel_append:'..rayCast.object:getID()..':'..rayCast.object.name..':'..tostring(desc.selection))
					if not desc.selection then desc.selection = {} end
							for i,c in pairs(floor.top.achild) do
--                                U.dump(c, '?? for_LIST2:'..i..':'..inrc..' scch:'..tostring(scchild)..':'..#U.index(c.list, inrc))
								if #U.index(c.list, inrc) > 0 then
						end
							lo('?? inrc:'..tostring(inrc)..':'..tostring(floor.top.cchild))
	--                        U.dump(floor.top.achild, '?? achild:')
						end
							lo('?? inrc:'..tostring(inrc)..':'..tostring(floor.top.cchild))
	--                        U.dump(floor.top.achild, '?? achild:')
				else
					lo('!! NO_desc:'..tostring(cedit.mesh)..':'..tostring(cij)..':'..tableSize(adesc))
				end
				else
					lo('!! NO_desc:'..tostring(cedit.mesh)..':'..tostring(cij)..':'..tableSize(adesc))
				end
		else
			lo('?? mup_ol_reset:'..objLevel..':'..tostring(scope)..':'..tostring(indrag))
			inject.R.out.apick = nil
		else
			lo('?? mup_ol_reset:'..objLevel..':'..tostring(scope)..':'..tostring(indrag))
			inject.R.out.apick = nil
--        U.dump(out.avedit, '<< mup:'..#out.avedit)
		U.dump(cij, '<< mup:'..tostring(cmesh))
	return true
--            _dbdrag = true
--        lo('?? mpoint:'..tostring(cedit.mesh)..':'..tostring(rayCast)..':'..tostring(_dbdrag))
		if _dbdrag then return end
--            _dbdrag = true
--        lo('?? mpoint:'..tostring(cedit.mesh)..':'..tostring(rayCast)..':'..tostring(_dbdrag))
		if _dbdrag then return end
--            _dbdrag = true
--        lo('?? mpoint:'..tostring(cedit.mesh)..':'..tostring(rayCast)..':'..tostring(_dbdrag))
		if _dbdrag then return end
	if nm == nil or nm == 'theTerrain' then return end
--            lo('?? mpoint2:'..tostring(cedit.mesh)..':'..nm..':'..tostring(intopchange))
	if string.find(nm, 'o_') == 1 then
	if nm == nil or nm == 'theTerrain' then return end
--            lo('?? mpoint2:'..tostring(cedit.mesh)..':'..nm..':'..tostring(intopchange))
	if string.find(nm, 'o_') == 1 then
--        _dbdrag = true
--        lo('?? point:'..tostring(indrag))
--        lo('?? mpoint:'..id..':'..#cij..':'..tostring(rayCast.pos)..':'..tostring(cedit.part))
--        lo('?? point:'..tostring(indrag))
--        lo('?? mpoint:'..id..':'..#cij..':'..tostring(rayCast.pos)..':'..tostring(cedit.part))
		local bdesc = adesc[cedit.mesh]
--        lo('?? point:'..tostring(indrag))
--        lo('?? mpoint:'..id..':'..#cij..':'..tostring(rayCast.pos)..':'..tostring(cedit.part))
		local bdesc = adesc[cedit.mesh]
			local om = scenetree.findObject(nm)
				lo('??******* forMM:'..id..':'..nm..':'..tostring(om.obj)..':'..tostring(om.vdata)..':'..tostring(#aedit[id].mesh)) --..':'..tostring(om:getMesh())..':'..tostring(aedit[id]), true)
			local part,face = M.faceHit(aedit[id].mesh)
			local om = scenetree.findObject(nm)
				lo('??******* forMM:'..id..':'..nm..':'..tostring(om.obj)..':'..tostring(om.vdata)..':'..tostring(#aedit[id].mesh)) --..':'..tostring(om:getMesh())..':'..tostring(aedit[id]), true)
			local part,face = M.faceHit(aedit[id].mesh)
			local om = scenetree.findObject(nm)
				lo('??******* forMM:'..id..':'..nm..':'..tostring(om.obj)..':'..tostring(om.vdata)..':'..tostring(#aedit[id].mesh)) --..':'..tostring(om:getMesh())..':'..tostring(aedit[id]), true)
			local part,face = M.faceHit(aedit[id].mesh)
			local om = scenetree.findObject(nm)
				lo('??******* forMM:'..id..':'..nm..':'..tostring(om.obj)..':'..tostring(om.vdata)..':'..tostring(#aedit[id].mesh)) --..':'..tostring(om:getMesh())..':'..tostring(aedit[id]), true)
			local part,face = M.faceHit(aedit[id].mesh)
			local om = scenetree.findObject(nm)
				lo('??******* forMM:'..id..':'..nm..':'..tostring(om.obj)..':'..tostring(om.vdata)..':'..tostring(#aedit[id].mesh)) --..':'..tostring(om:getMesh())..':'..tostring(aedit[id]), true)
			local part,face = M.faceHit(aedit[id].mesh)
			dir = vec3(-dir.y, dir.x):normalized()
				lo('?? orig:'..tostring(pos)..':'..tostring(dir))
			M.dissect(pos, dir, mdata)
			dir = vec3(-dir.y, dir.x):normalized()
				lo('?? orig:'..tostring(pos)..':'..tostring(dir))
			M.dissect(pos, dir, mdata)
						aface[#aface+1] = i
--                        lo('??+++++++ fit:'..i..':'..tostring(mdata.verts[mdata.faces[i].v+1])..':'..d)
					end
--            if editor.keyModifiers.ctrl then
--                    lo('?? ptr:'..tostring(cmouse))
				if cedit.cval['AltZ'] == nil then
				if cedit.cval['AltMove'] == nil then
					lo('??++++____+++ point_start:'..cij[1]..':'..tostring(dpos))
					cedit.cval['AltMove'] = {forHeight(adesc[cedit.mesh].afloor, cij[1])}
				cmouse.z = cedit.cval['AltMove'][1]+adesc[cedit.mesh].pos.z
--                    lo('?? TSL2:'..tostring(dpos)..':'..tostring(cmouse))
				if dpos ~= nil and dpos:length() > 0.001 then
				cmouse.z = cedit.cval['AltMove'][1]+adesc[cedit.mesh].pos.z
--                    lo('?? TSL2:'..tostring(dpos)..':'..tostring(cmouse))
				if dpos ~= nil and dpos:length() > 0.001 then
				if dpos ~= nil and dpos:length() > 0.001 then
--                        lo('?? for_DPOS:'..tostring(W.ui.dbg)..':'..tostring(dpos))
	--                                lo('?? dpos:'..tostring(u)..':'..tostring(dpos)..':'..tostring(cmouse))
				if dpos ~= nil and dpos:length() > 0.001 then
--                        lo('?? for_DPOS:'..tostring(W.ui.dbg)..':'..tostring(dpos))
	--                                lo('?? dpos:'..tostring(u)..':'..tostring(dpos)..':'..tostring(cmouse))
--                        lo('?? for_DPOS:'..tostring(W.ui.dbg)..':'..tostring(dpos))
	--                                lo('?? dpos:'..tostring(u)..':'..tostring(dpos)..':'..tostring(cmouse))
					-- get intersections with boundaries
--                        lo('?? for_DPOS:'..tostring(W.ui.dbg)..':'..tostring(dpos))
	--                                lo('?? dpos:'..tostring(u)..':'..tostring(dpos)..':'..tostring(cmouse))
					-- get intersections with boundaries
--                        lo('?? for_DPOS:'..tostring(W.ui.dbg)..':'..tostring(dpos))
	--                                lo('?? dpos:'..tostring(u)..':'..tostring(dpos)..':'..tostring(cmouse))
					-- get intersections with boundaries
								local ds = v - dir*dir:dot(v)
	--                                lo('?? HIT:'..i..':'..tostring(base[i])..':'..tostring(ds))
								lmouse = lmouse + ds
								local ds = v - dir*dir:dot(v)
	--                                lo('?? HIT:'..i..':'..tostring(base[i])..':'..tostring(ds))
								lmouse = lmouse + ds
								local ds = v - dir*dir:dot(v)
	--                                lo('?? HIT:'..i..':'..tostring(base[i])..':'..tostring(ds))
								lmouse = lmouse + ds
								local ds = v - dir*dir:dot(v)
	--                                lo('?? HIT:'..i..':'..tostring(base[i])..':'..tostring(ds))
								lmouse = lmouse + ds
]]
--                            lo('?? pre_hit:'..tostring(pos)..':'..tostring(cmouse))
					aint = U.polyCross(base, lmouse, dpos:cross(vec3(0,0,1)))
]]
--                            lo('?? pre_hit:'..tostring(pos)..':'..tostring(cmouse))
					aint = U.polyCross(base, lmouse, dpos:cross(vec3(0,0,1)))
					aint = U.polyCross(base, lmouse, dpos:cross(vec3(0,0,1)))
--                            U.dump(aint, '?? wspl: pos:'..tostring(pos)..' cm:'..tostring(cmouse)..':'..#out.wsplit)
					if #aint == 2 then
					aint = U.polyCross(base, lmouse, dpos:cross(vec3(0,0,1)))
--                            U.dump(aint, '?? wspl: pos:'..tostring(pos)..' cm:'..tostring(cmouse)..':'..#out.wsplit)
					if #aint == 2 then
--                            local pleft,pright = U.polyCross(floor.base, cmouse, dpos:cross(vec3(0,0,1)))
--                                lo('?? LR:'..tostring(pleft)..':'..tostring(pright))
							W.ui.dbg = false
--                            local pleft,pright = U.polyCross(floor.base, cmouse, dpos:cross(vec3(0,0,1)))
--                                lo('?? LR:'..tostring(pleft)..':'..tostring(pright))
							W.ui.dbg = false
						end
--                            U.dump(aint,'?? aint:'..#aint..':'..tostring(adesc[cedit.mesh].pos))
					if #aint == 2 then
-- SPLIT LINE wall RENDER
--                lo('?? forff:'..tostring(id)..':'..rayCast.object.name)
--                lo('?? if_SL:'..tostring(otype))
--                lo('?? forff:'..tostring(id)..':'..rayCast.object.name)
--                lo('?? if_SL:'..tostring(otype))
			local otype = name2type(rayCast.object.name)
			local otype = name2type(rayCast.object.name)
--                lo('?? if_SL:'..tostring(otype)..':'..tostring(id)..':'..cedit.mesh)
			if otype == 'spline' then
			local otype = name2type(rayCast.object.name)
--                lo('?? if_SL:'..tostring(otype)..':'..tostring(id)..':'..cedit.mesh)
			if otype == 'spline' then
					for j,d in pairs(a) do
--							U.dump(d, '?? for_D:'..d.id..':'..id..':'..tostring(tostring(d.id) == tostring(id)))
						if tostring(d.id) == tostring(id) then
					for j,d in pairs(a) do
--							U.dump(d, '?? for_D:'..d.id..':'..id..':'..tostring(tostring(d.id) == tostring(id)))
						if tostring(d.id) == tostring(id) then
					for j,d in pairs(a) do
--							U.dump(d, '?? for_D:'..d.id..':'..id..':'..tostring(tostring(d.id) == tostring(id)))
						if tostring(d.id) == tostring(id) then
--							U.dump(d, '?? for_D:'..d.id..':'..id..':'..tostring(tostring(d.id) == tostring(id)))
						if tostring(d.id) == tostring(id) then
							-- check if node
--							U.dump(d, '?? for_D:'..d.id..':'..id..':'..tostring(tostring(d.id) == tostring(id)))
						if tostring(d.id) == tostring(id) then
							-- check if node
							local rproj = U.proj2D(rayCast.pos)
--								lo('?? if_CORN:'..H..':'..tostring(rproj))
							local hit = false
								if true then
--										lo('?? va:'..tostring(U.proj2D(v))..':'..tostring(U.proj2D(rayCast.pos)))
									local a,b = v+vec3(0,0,H),v+vec3(0,0,H+desc.afloor[i].h)
								if true then
--										lo('?? va:'..tostring(U.proj2D(v))..':'..tostring(U.proj2D(rayCast.pos)))
									local a,b = v+vec3(0,0,H),v+vec3(0,0,H+desc.afloor[i].h)
								local box = d.o:getWorldBox()
	--								lo('?? cCast:'..tostring(rayCast.pos)..':'..tostring(box.minExtents)..':'..tostring(box.maxExtents))
								out.asplit = {{line={
								local box = d.o:getWorldBox()
	--								lo('?? cCast:'..tostring(rayCast.pos)..':'..tostring(box.minExtents)..':'..tostring(box.maxExtents))
								out.asplit = {{line={
								local box = d.o:getWorldBox()
	--								lo('?? cCast:'..tostring(rayCast.pos)..':'..tostring(box.minExtents)..':'..tostring(box.maxExtents))
								out.asplit = {{line={
			if not aedit[id] or not aedit[id].desc then
				lo('!! NO_desc:'..id..':'..tostring(nm))
				return
			end
--                lo('?? if_SL2:'..tostring(indrag)..':'..tostring(intopchange))
			local cij = aedit[id].desc.ij
			end
--                lo('?? if_SL2:'..tostring(indrag)..':'..tostring(intopchange))
			local cij = aedit[id].desc.ij
--            _dbdrag = true
--            lo('?? mwheel:'..tostring(rayCast)..':'..tostring(cmesh))--..tostring(({scope = 1})['scope']))
	if rayCast == nil then return end
--            _dbdrag = true
--            lo('?? mwheel:'..tostring(rayCast)..':'..tostring(cmesh))--..tostring(({scope = 1})['scope']))
	if rayCast == nil then return end
--            _dbdrag = true
--            lo('?? mwheel:'..tostring(rayCast)..':'..tostring(cmesh))--..tostring(({scope = 1})['scope']))
	if rayCast == nil then return end
]]
--            lo('>> mwheel:'..tostring(nm)..':'..scope)
	if cmesh ~= nil then
	--            dmesh[cmesh].data = amesh
	--                    lo('?? moved:'..cmesh..':'..n..':'..tostring(dirobj)..':'..dir..':'..tostring(amesh[1].verts[1]))
				M.update(dmesh[cmesh])
	--            dmesh[cmesh].data = amesh
	--                    lo('?? moved:'..cmesh..':'..n..':'..tostring(dirobj)..':'..dir..':'..tostring(amesh[1].verts[1]))
				M.update(dmesh[cmesh])
	if U._PRD==0 and editor.keyModifiers.alt then
--            lo('?? resz:'..tostring(cedit.cval['AltZ'] ~= nil))
		if cedit.cval['AltZ'] ~= nil then
--                lo('?? AltZ:')
--            lo('?? weelresz:'..tostring(cedit.cval['AltZ'][3]))
--        if im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
			cedit.cval['AltZ'][3] = cedit.cval['AltZ'][3] + 0.04 * dir
--                lo('?? to_resz:'..tostring(cedit.cval['AltZ'][3]))
			out.avedit = {
--            local tp = dforest[]
				if dforest[cedit.forest] then lo('?? fof:'..tostring(dforest[cedit.forest].type)) end
			if dforest[cedit.forest] and dforest[cedit.forest].type == 'win' then
				end
				--                    lo('?? fofor:'..tostring(cedit.forest))
				houseUp(adesc[cedit.mesh], cedit.mesh)
--                    if true then return end
--                   lo('?? Alt_Wheel:'..tostring(cij[1])..':'..tostring(shape))
			if ({pyramid=1,shed=1,gable=1})[shape] then
--                    if true then return end
--                   lo('?? Alt_Wheel:'..tostring(cij[1])..':'..tostring(shape))
			if ({pyramid=1,shed=1,gable=1})[shape] then
				local floor = adesc[cedit.mesh].afloor[cij[1]]
--                    lo('?? Alt_Wheel2:'..tostring(#floor.top.achild))
				if #floor.top.achild > 0 then
					elseif floor.top.ang ~= nil then
--                        lo('??____________ for_WHOLE:'..tostring(floor.top.ang)..':'..floor.top.shape)
						floor.top.ang = floor.top.ang + 0.02 * dir
--                local w = floor.awall[1]
--                U.dump(w.uv,'??++++++++ for_w:'..tostring(w.v))
			houseUp(adesc[cedit.mesh], cedit.mesh)
			local f = desc.afloor[ij[1]]
--                lo('>> forWall:'..tostring(f), true)
			local base = f.base
			local desc = adesc[dforest[cedit.forest].mesh]
				U.dump(desc.afloor[2].awall[1].df, '?? FOREST_scale:'..tostring(dforest[cedit.forest].type))
			if not cedit.cval['DragScale'] then cedit.cval['DragScale'] = {} end
--                end
--                    lo('?? pre_scale:'..ij[1]..':'..ij[2]..':'..tostring(w.win), true)
				w.df[w.win].scale = w.df[w.win].scale*(1 + 0.02*dir)
					for _,j in pairs(f) do
--                            lo('?? for_wall:'..tostring(f)..':'..tostring(j))
						forWall({i,j})
					for _,j in pairs(f) do
--                            lo('?? for_wall:'..tostring(f)..':'..tostring(j))
						forWall({i,j})
			-- TODO: update roof
--                lo('?? to_EXT:'..tostring(adesc[cedit.mesh].afloor[cij[1]].top.shape), true)
			if adesc[cedit.mesh].afloor[cij[1]].top.shape == 'gable' then
--            local tp = dforest[]
--                lo('?? fof:'..tostring(dforest[cedit.forest].type))
			if dforest[cedit.forest].type == 'win' then
				end)
--                    lo('?? fofor:'..tostring(cedit.forest))
				markUp(wdae)
local function keyUD(dir)
	lo('?? W.keyUD:'..dir..':'..tostring(cedit.forest))
	if out.inconform and editor.keyModifiers.ctrl then
			if dir < 0 and cij[1] == 1 then return end
					lo('?? to_fflip:'..cij[1]..':'..tostring(cedit.mesh))
			local s_top
			-- flip tops
					U.dump(s_top, '?? s_top:'..tostring(s_top))
			if floor.top and s_top then
		if ({top=1, wall=1, side=1})[scope] ~= nil then
					lo('?? mat_scale:'..scope..':'..tostring(cij[2]), true)
			local wdesc = adesc[cedit.mesh].afloor[cij[1]].awall[cij[2]]
				floor = adesc[cedit.mesh].afloor[#adesc[cedit.mesh].afloor]
					lo('??____+++___ ifchild:'..tostring(floor.top.cchild)..':'..tostring(floor.top.shape))
				local base
				floor = adesc[cedit.mesh].afloor[#adesc[cedit.mesh].afloor]
					lo('??____+++___ ifchild:'..tostring(floor.top.cchild)..':'..tostring(floor.top.shape))
				local base
				floor.top.shape = 'flat'
					lo('?? RE_shape:'..tostring(newfloor.top.shape))
				cij[1] = cij[1] + 1
--                        local w = house.afloor[#house.afloor-1].awall[1]
--                        lo('?? for_ij: id='..tostring(w.id)..':'..#house.afloor..':'..house.afloor[#house.afloor-1].awall[1].ij[1])
		end
		local mtype = dforest[cedit.forest].type
--            lo('?? keyUD.mesh_change:'..tostring(cedit.forest)..':'..tostring(mtype)..':'..dir..':'..#daePath[mtype])
		out.curselect = (out.curselect or 0) - dir
		local mtype = dforest[cedit.forest].type
--            lo('?? keyUD.mesh_change:'..tostring(cedit.forest)..':'..tostring(mtype)..':'..dir..':'..#daePath[mtype])
		out.curselect = (out.curselect or 0) - dir
		out.curselect = (out.curselect or 0) - dir
--            lo('?? for_CS:'..tostring(out.curselect))
		if out.curselect < 0 then out.curselect = 0 end
local function keyRL(dir)
--    lo('??----------- keyRL:'..dir..':'..tostring(out.inconform)..':'..mantle) --..tostring(dforest[cedit.forest]))
	if out.inconform and editor.keyModifiers.ctrl then
local function keyRL(dir)
--    lo('??----------- keyRL:'..dir..':'..tostring(out.inconform)..':'..mantle) --..tostring(dforest[cedit.forest]))
	if out.inconform and editor.keyModifiers.ctrl then
	end
--        lo('?? keyRL:'..tostring(editor.keyModifiers.ctrl)..':'..tostring(editor.keyModifiers.alt))
--        if editor.keyModifiers.ctrl then return end
	end
--        lo('?? keyRL:'..tostring(editor.keyModifiers.ctrl)..':'..tostring(editor.keyModifiers.alt))
--        if editor.keyModifiers.ctrl then return end
	elseif dforest[cedit.forest] ~= nil then
--        lo('?? fof:'..tostring(cedit.part)..':'..dforest[cedit.forest].type..':'..dforest[cedit.forest].mesh)
		if dforest[cedit.forest].type == 'door' then
					if w.doorind < 1 then w.doorind = 1 end
						lo('??___for_ind:'..ij[1]..':'..tostring(cedit.forest))
					if w.doorind > #w.df[w.win]+1 then
					if w.doorind > #w.df[w.win]+1 then
--                        lo('?? for_ind:'..ij[2]..':'..tostring(w.doorind)..':'.. tostring(#w.df[w.win]))
						w.doorind = #w.df[w.win] + 1
					if w.doorind > #w.df[w.win]+1 then
--                        lo('?? for_ind:'..ij[2]..':'..tostring(w.doorind)..':'.. tostring(#w.df[w.win]))
						w.doorind = #w.df[w.win] + 1
]]
--                        lo('?? iwall:'..tostring(iwall))
					end
				wall.df[]
--                lo('?? door_flip:'..iwall..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest].item))
			end
				wall.df[]
--                lo('?? door_flip:'..iwall..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest].item))
			end
			houseUp(adesc[cedit.mesh], cedit.mesh, true)
					lo('?? dfor:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]))
			markUp(dforest[cedit.forest].item:getData():getShapeFile())
			houseUp(adesc[cedit.mesh], cedit.mesh, true)
					lo('?? dfor:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]))
			markUp(dforest[cedit.forest].item:getData():getShapeFile())
--            U.dump(desc, '?? wdesc:')
--            lo('?? desc:'..tostring(desc.doorind))
		elseif dforest[cedit.forest].type == 'win' then
		lo('>> onKey:'..key)
--    if tostring(key) == '525' then
	if key == im.GetKeyIndex(im.Key_Escape) then
				dmesh[cmesh].obj:createMesh({amesh})
						lo('?? seled:'..tostring(#dmesh[cmesh].data)..':'..tostring(#dmesh[cmesh].sel)..':'..tostring(#dmesh[cmesh].buf))
				M.mark(dmesh[cmesh].sel, out)
				dmesh[cmesh].obj:createMesh({amesh})
						lo('?? seled:'..tostring(#dmesh[cmesh].data)..':'..tostring(#dmesh[cmesh].sel)..':'..tostring(#dmesh[cmesh].buf))
				M.mark(dmesh[cmesh].sel, out)
				dmesh[cmesh].obj:createMesh({amesh})
						lo('?? seled:'..tostring(#dmesh[cmesh].data)..':'..tostring(#dmesh[cmesh].sel)..':'..tostring(#dmesh[cmesh].buf))
				M.mark(dmesh[cmesh].sel, out)
local function keyAlt(yes)
--        lo('?? keyAlt:'..tostring(yes))
	intopchange = false
	if not yes then
--			lo('?? keyShift:'..tostring(yes))
		intopchange = false
			--                out.apoint = {center + vec3(0,0,6)}
					U.dump(base, '?? to_AROUND:'..scope..':'..cij[1]..':'..tostring(center))
			cedit.cval['CamRot'] = {
	local dirnew = U.vturn(dirpre, -0.00*dir):normalized()
--            lo('?? in_AROUND:'..tostring(dirpre)..'>'..tostring(dirnew)..':'..a)
	local dirnew = U.vturn(dirpre, -0.00*dir):normalized()
--            lo('?? in_AROUND:'..tostring(dirpre)..'>'..tostring(dirnew)..':'..a)
	local newpos = ccenter - newdir
--    lo('>> goAround:'..tostring(cedit.mesh)..':'..tostring(pos)..' cent:'..tostring(ccenter)..' dir:'..tostring(dir)..' nd:'..tostring(newdir))
	local newpos = ccenter - newdir
--    lo('>> goAround:'..tostring(cedit.mesh)..':'..tostring(pos)..' cent:'..tostring(ccenter)..' dir:'..tostring(dir)..' nd:'..tostring(newdir))
	local newpos = ccenter - newdir
--    lo('>> goAround:'..tostring(cedit.mesh)..':'..tostring(pos)..' cent:'..tostring(ccenter)..' dir:'..tostring(dir)..' nd:'..tostring(newdir))
	local newpos = ccenter - newdir
--    lo('>> goAround:'..tostring(cedit.mesh)..':'..tostring(pos)..' cent:'..tostring(ccenter)..' dir:'..tostring(dir)..' nd:'..tostring(newdir))
	local newpos = ccenter - newdir
--    lo('>> goAround:'..tostring(cedit.mesh)..':'..tostring(pos)..' cent:'..tostring(ccenter)..' dir:'..tostring(dir)..' nd:'..tostring(newdir))
--    local obj = scenetree.findObjectById(cedit.mesh)
--    lo('?? goAround:'..tostring(obj:getPosition()))
--    U.dump(adesc[cedit.mesh], '?? desc:')

		lo('?? RA:'..tostring(direction)..':'..tostring(startPoint))
	--    local newPos = U.vturn(U.proj2D(startPoint - direction), 0.05) + vec3(0, 0, startPoint.z)

		lo('?? RA:'..tostring(direction)..':'..tostring(startPoint))
	--    local newPos = U.vturn(U.proj2D(startPoint - direction), 0.05) + vec3(0, 0, startPoint.z)
	if W.ui.dbg then
		lo('?? to_DBG:'..tostring(cij)..':'..tostring(cedit.mesh), true)
--        W.ui.dbg = false
	if W.ui.dbg then
		lo('?? to_DBG:'..tostring(cij)..':'..tostring(cedit.mesh), true)
--        W.ui.dbg = false
		if not desc then
				lo('!! ERR_uiUpdate_NODESC:'..tostring(cedit.mesh))
			cedit.mesh = nil
--            if wall.pilaster and wall.pilaster.aind[3] then
--                lo('?? for_PI:'..tostring(W.ui.pilaster_ind2))
--            end
			if W.ui.dbg then
				lo('?? PPPL:'..#wall.pilaster.aind..':'..tostring(cij[2])) --..':'..tostring(W.ui.pilaster_ind0)..':'..tostring(W.ui.pilaster_ind1)..':'..tostring(W.ui.pilaster_ind2), true)
				W.ui.dbg = false
			if W.ui.dbg then
				lo('?? PPPL:'..#wall.pilaster.aind..':'..tostring(cij[2])) --..':'..tostring(W.ui.pilaster_ind0)..':'..tostring(W.ui.pilaster_ind1)..':'..tostring(W.ui.pilaster_ind2), true)
				W.ui.dbg = false
			if W.ui.dbg then
				lo('?? PPPL:'..#wall.pilaster.aind..':'..tostring(cij[2])) --..':'..tostring(W.ui.pilaster_ind0)..':'..tostring(W.ui.pilaster_ind1)..':'..tostring(W.ui.pilaster_ind2), true)
				W.ui.dbg = false
			if W.ui.dbg then
				lo('?? PPPL:'..#wall.pilaster.aind..':'..tostring(cij[2])) --..':'..tostring(W.ui.pilaster_ind0)..':'..tostring(W.ui.pilaster_ind1)..':'..tostring(W.ui.pilaster_ind2), true)
				W.ui.dbg = false
			if not desc.afloor[cij[1]].top.achild[desc.afloor[cij[1]].top.cchild] then
				lo('!! ERR_NO_CHILD: cij1:'..tostring(cij[1])..':'..#desc.afloor[cij[1]].top.achild)
				desc.afloor[cij[1]].top.cchild = nil
	local val
		lo('?? voice2build:'..tostring(cmd)..':'..#atoken..':'..#adesc)
		lo('DO:'..tostring(cmd))
		lo('?? voice2build:'..tostring(cmd)..':'..#atoken..':'..#adesc)
		lo('DO:'..tostring(cmd))
	if string.find(cmd, 'clear') then
		local desc = buildingGen(vec3(math.random(10),math.random(10)))
			lo('?? created:'..#adesc..':'..tostring(cedit.mesh)..':'..tostring(desc.id)) --..':'..adesc[1].id)
		cedit.mesh = desc.id
		local desc = buildingGen(vec3(math.random(10),math.random(10)))
			lo('?? created:'..#adesc..':'..tostring(cedit.mesh)..':'..tostring(desc.id)) --..':'..adesc[1].id)
		cedit.mesh = desc.id
			val = atoken[ind-1]
				lo('?? degree:'..tostring(val))
			W.onVal('building_ang', tonumber(val))
				val = atoken[ind+1]
					lo('?? floor_num:'..tostring(val)) --..':'..tostring(tonumber(val)))
				if val == 'first' then
				val = atoken[ind+1]
					lo('?? floor_num:'..tostring(val)) --..':'..tostring(tonumber(val)))
				if val == 'first' then
		local ind = U.index(atoken, 'meter')[1] or U.index(atoken, 'meters')[1] or U.index(atoken, 'm')[1]
			lo('for_height1:'..tostring(ind))
		if ind then
			val = tonumber(atoken[ind-1])
			lo('?? for_height2:'..tostring(val))
			if scope == 'floor' then
			if inroad then
				lo('?? from_D.upd:'..tostring(inroad))
				out.inroad = inroad
	if im.IsMouseReleased(0) then
--			lo('?? if_interr:'..tostring(out.interr))
		if out.interr then
	if w ~= 0 then
--			lo('?? W.wheel:'..tostring(out.interr))
		if out.interr then
			local conf = jsonReadFile(setfile)
				U.dump(conf,'?? check:'..tostring(setfile))
			FS:removeFile(setfile)
			io.close(file)
		--                lo('?? for_COMMAND:'..tostring(#command)..':'..tostring(#out.ccommand))
			if command ~= out.ccommand and #command > 2 then
			io.close(file)
		--                lo('?? for_COMMAND:'..tostring(#command)..':'..tostring(#out.ccommand))
			if command ~= out.ccommand and #command > 2 then
			if command ~= out.ccommand and #command > 2 then
				lo('?? for_COMMAND2:'..tostring(#command)..':'..tostring(#out.ccommand))
		--        if not out.ccommand or command ~= out.ccommand then
			if command ~= out.ccommand and #command > 2 then
				lo('?? for_COMMAND2:'..tostring(#command)..':'..tostring(#out.ccommand))
		--        if not out.ccommand or command ~= out.ccommand then
		out.ctime = ctime
--            lo('?? test:'..command..':'..tostring(os.clock()))
	end
	if editor.keyModifiers.ctrl and im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
--            lo('?? to_restoere:'..#asave..':'..tostring(cedit.mesh)..':'..tostring(inrollback))
		if not inrollback then
	if editor.keyModifiers.ctrl and im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
--            lo('?? to_restoere:'..#asave..':'..tostring(cedit.mesh)..':'..tostring(inrollback))
		if not inrollback then
			else
					lo('?? to_restore:'..#asave, true) --..':'..tostring(cedit.mesh)..':'..tostring(inrollback))
				undo()
			else
					lo('?? to_restore:'..#asave, true) --..':'..tostring(cedit.mesh)..':'..tostring(inrollback))
				undo()
			end
--                lo('?? restored:'..#asave..':'..tostring(inrollback))
--[[
				markUp()
					lo('?? restored:'..tostring(cedit.mesh))
			end
--            for j,f in pairs(desc.afloor) do
--                lo('?? for_child:'..j..':'..tostring(f.achild))
--            end
--        asave[#asave+1] = math.floor(socket.gettime())
			lo('?? for_JSON:'..#asave..':'..fsave) --..tostring(adesc[cedit.mesh]))
		jsonWriteFile(fsave..'_'..asave[1][1]..'.json', desc)
		if out.inhole then
--                lo('?? HOLE:'..tostring(#out.inhole.achild))
			if out.inhole.achild then
			end
--                lo('?? HOLE2:'..tostring(#out.inhole.achild))
--            out.inhole = nil
		end
			lo('??----------------- to_del:'..tostring(cedit.mesh)..':'..tostring(out.inhole), true)
--            if true then return end
		end
			lo('??----------------- to_del:'..tostring(cedit.mesh)..':'..tostring(out.inhole), true)
--            if true then return end
				for k,c in pairs(adesc[desc.prn].afloor[desc.floor-1].achild) do
--                    lo('?? for_child:'..k..':'..tostring(c.id))
					if c.id == cedit.mesh then
			end
				lo('?? DEL_building:'..cedit.mesh..':'..tostring(desc.id))
			scenetree.findObject('edit'):deleteAllObjects()
			if l[2] then
				debugDrawer:drawText(l[1], String(tostring(l[2])), ColorF(0,0,1,1))
			end
--            if editor.keyModifiers.alt then
--                lo('?? for_ALT:'..tostring(cameraMouseRayCast(false).object.name))
--            end
--			if row.noz then
--				U.dump(row, '?? if_CORNER:'..tostring(out.acorner))
--			end
--        if im.IsMouseClicked(0) then
--            lo('?? for_RCSDSS:'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name))
--        end
--        if im.IsMouseClicked(0) then
--            lo('?? for_RCSDSS:'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name))
--        end
--            mdrag(rayCast)
--            lo('?? for_VE:'..tostring(out.invertedge))
--            return
		if not indrag then
--				print('??___________ RCON:'..tostring(rayCast.object.name))
--			out.over = rayCast.object.name and string.find(rayCast.object.name, 'o_wall') or false
--			out.over = rayCast.object.name and string.find(rayCast.object.name, 'o_wall') or false
--				print('?? is_OVER:'..tostring(out.over)..':'..rayCast.object.name)
			local desc = adesc[cedit.mesh]
							end
--                                lo('?? ishit:'..tostring(ishit.ij[2]))
--!!                            out.invertedge = ishit
							end)
--                                lo('?? for_corners:'..#out.acorner..':'..tostring(out.invertedge))
							incorner = out.acorner
							local b = base2world(desc, {ij[1], ij[2] % #base + 1}) --base[ij[2] % #base + 1] + desc.pos
			--                    lo('?? ab:'..tostring(a)..':'..tostring(b)..':'..tostring(desc.pos)..':'..tostring(rayCast.pos))
							for k,p in pairs({a, b}) do
							local b = base2world(desc, {ij[1], ij[2] % #base + 1}) --base[ij[2] % #base + 1] + desc.pos
			--                    lo('?? ab:'..tostring(a)..':'..tostring(b)..':'..tostring(desc.pos)..':'..tostring(rayCast.pos))
							for k,p in pairs({a, b}) do
							local b = base2world(desc, {ij[1], ij[2] % #base + 1}) --base[ij[2] % #base + 1] + desc.pos
			--                    lo('?? ab:'..tostring(a)..':'..tostring(b)..':'..tostring(desc.pos)..':'..tostring(rayCast.pos))
							for k,p in pairs({a, b}) do
							local b = base2world(desc, {ij[1], ij[2] % #base + 1}) --base[ij[2] % #base + 1] + desc.pos
			--                    lo('?? ab:'..tostring(a)..':'..tostring(b)..':'..tostring(desc.pos)..':'..tostring(rayCast.pos))
							for k,p in pairs({a, b}) do
										local vp = p - core_camera.getPosition()
--                                        lo('?? for dir:'..s) --..tostring(ray.dir)..':'..tostring(vp))
									end
										local vp = p - core_camera.getPosition()
--                                        lo('?? for dir:'..s) --..tostring(ray.dir)..':'..tostring(vp))
									end

	--                    lo('?? if_CO__1:'..tostring(rayCast.object.name))
				if editor.keyModifiers.shift and not out.inedge then
						end
	--                        U.dump(aedit[id].desc.ij, '?? for_ij:'..tostring(otype))

	--                lo('?? look for borders:'..tostring())
							local base = floor.base
							if U._PRD==0 and ijhit then
	--                                U.dump(ijhit, '?? ijhit:'..tostring(istop))
								out.aedge = {e = {}, ij = ijhit, top = istop}
								for i = 1,#base do
		--                        lo('?? for_p:'..tostring(base2world(desc, ij)))
		--                        _dbdrag = true
					else
	--                    lo('!! no_IJ:'..id..':'..tostring(aedit[id]))
					end
						end
	--                        U.dump(aside, '?? PM:'..tostring(mi)..':'..tostring(ma)..':'..tostring(u)..':'..cij[2])
						if mi and ma then
						end
	--                        U.dump(aside, '?? PM:'..tostring(mi)..':'..tostring(ma)..':'..tostring(u)..':'..cij[2])
						if mi and ma then
						end
	--                        U.dump(aside, '?? PM:'..tostring(mi)..':'..tostring(ma)..':'..tostring(u)..':'..cij[2])
						if mi and ma then
							out.middle = {line = {pm, pm + vec3(0,0,desc.afloor[cij[1]].h)}, ij = cij}
	--                            lo('?? PM2:'..tostring(pm)..':'..mi..':'..ma..':'..tostring(u)..':'..cij[2], true)
						end
							out.middle = {line = {pm, pm + vec3(0,0,desc.afloor[cij[1]].h)}, ij = cij}
	--                            lo('?? PM2:'..tostring(pm)..':'..mi..':'..ma..':'..tostring(u)..':'..cij[2], true)
						end
							out.middle = {line = {pm, pm + vec3(0,0,desc.afloor[cij[1] ].h)}, ij = cij}
					--                            U.dump(aside, '?? for_side:'..cij[1]..':'..#aside[cij[1] ]..':'..tostring(pm))
					--                            _dbdrag = true
			mdrag(rayCast)
--            lo('?? for_VE:'..tostring(out.invertedge))
--            return
		scenetree.findObjectById(desc.id):delete()
				lo('?? RESTORE:'..csave..':'..tostring(asave[csave])..'-'..desc.id)
		-- restore from history
		end
--            lo('?? fj1:'..tostring(desc.pos)..':'..tostring(desc.id))
	--        U.dump(desc.pos, '?? fj1:'..tostring(desc.pos))
		end
--            lo('?? fj1:'..tostring(desc.pos)..':'..tostring(desc.id))
	--        U.dump(desc.pos, '?? fj1:'..tostring(desc.pos))
--            lo('?? fj1:'..tostring(desc.pos)..':'..tostring(desc.id))
	--        U.dump(desc.pos, '?? fj1:'..tostring(desc.pos))
		houseUp(desc)
	if editor.keyModifiers.ctrl then
--            lo('?? for_CTRL:'..tostring(im.IsKeyDown(im.GetKeyIndex(im.Key_J))))
		local desc = adesc[cedit.mesh]
-- PASTE
					U.dump(incopy[cedit.mesh], '??+++++++++++++++++++++++++++++++ to_PASTE:'..tableSize(incopy)..':'..tostring(out.invertedge))
			-- TODO: for between buildings
						local dsrc = adesc[id]
							U.dump(buf, '?? for_them:'..tostring(dsrc)..':'..tostring(scope))
						local ftgt = desc.afloor[cij[1]]
						local dsrc = adesc[id]
							U.dump(buf, '?? for_them:'..tostring(dsrc)..':'..tostring(scope))
						local ftgt = desc.afloor[cij[1]]
			else
					lo('?? paste_SAME:'..tableSize(incopy)..tostring(cedit.mesh)..':'..tostring(out.acorner)..':'..tostring(scope))
				local buf = incopy[cedit.mesh]
			else
					lo('?? paste_SAME:'..tableSize(incopy)..tostring(cedit.mesh)..':'..tostring(out.acorner)..':'..tostring(scope))
				local buf = incopy[cedit.mesh]
			else
					lo('?? paste_SAME:'..tableSize(incopy)..tostring(cedit.mesh)..':'..tostring(out.acorner)..':'..tostring(scope))
				local buf = incopy[cedit.mesh]
	--                                    if j == #ain.base then
	--                                        lo('?? for4:'..tostring(U.less(q, ain.p, ain.u)),true)
	--                                    end
					elseif scope == 'floor' then
							U.dump(buf, '?? for_FLOOR:'..tostring(buf))
						if #akey == 1 then
											ftgt = desc.afloor[i]
												lo('?? for_row:'..i..':'..tostring(desc)..':'..tostring(ftgt))
											for j,_ in pairs(r) do
											ftgt = desc.afloor[i]
												lo('?? for_row:'..i..':'..tostring(desc)..':'..tostring(ftgt))
											for j,_ in pairs(r) do
	-- PASTE child to floor
						U.dump(buf, '?? to_PASTE_f:'..cij[1]..':'..tostring(floor.pos))
						U.dump(akey, '?? for_topaste:'..tostring(floor.pos)..':'..tostring(scope))
						U.dump(buf, '?? to_PASTE_f:'..cij[1]..':'..tostring(floor.pos))
						U.dump(akey, '?? for_topaste:'..tostring(floor.pos)..':'..tostring(scope))
	--                    U.dump(desc.afloor[2].top, '?? 2nd_floor_PRE:'..#desc.afloor[2].awall)
						U.dump(buf, '?? to_PASTE_f:'..cij[1]..':'..tostring(floor.pos))
						U.dump(akey, '?? for_topaste:'..tostring(floor.pos)..':'..tostring(scope))
	--                    U.dump(desc.afloor[2].top, '?? 2nd_floor_PRE:'..#desc.afloor[2].awall)
					local samefloor = (akey[1] == newfloor and akey[#akey] == #dsrc.afloor)
							lo('?? newfloor:'..tostring(samefloor)..':'..tostring(newfloor)..'/'..#desc.afloor..':'..tostring(smouse))
					if newfloor then --and newfloor < #desc.afloor then
					local samefloor = (akey[1] == newfloor and akey[#akey] == #dsrc.afloor)
							lo('?? newfloor:'..tostring(samefloor)..':'..tostring(newfloor)..'/'..#desc.afloor..':'..tostring(smouse))
					if newfloor then --and newfloor < #desc.afloor then
					local samefloor = (akey[1] == newfloor and akey[#akey] == #dsrc.afloor)
							lo('?? newfloor:'..tostring(samefloor)..':'..tostring(newfloor)..'/'..#desc.afloor..':'..tostring(smouse))
					if newfloor then --and newfloor < #desc.afloor then
						for i = #akey,1,-1 do
	--                        lo('?? for_key:'..akey[i]..':'..tostring(buf[akey[i]]))
							if #buf[akey[i]] == #dsrc.afloor[akey[i]].base then
						end
	--                        lo('?? newpos_pre:'..tostring(rayCast.pos)..':'..tostring(desc.afloor[newfloor].pos))
						local posnew = U.proj2D(rayCast.pos - (desc.pos + desc.afloor[newfloor].pos + desc.afloor[newfloor].base[1]))
						end
	--                        lo('?? newpos_pre:'..tostring(rayCast.pos)..':'..tostring(desc.afloor[newfloor].pos))
						local posnew = U.proj2D(rayCast.pos - (desc.pos + desc.afloor[newfloor].pos + desc.afloor[newfloor].base[1]))
						end
							lo('??****** NEWPOS:'..tostring(posnew)..'/'..tostring(desc.pos)..':'..tostring(desc.afloor[newfloor].pos)..':'..tostring(desc.afloor[newfloor].base[1])..':'..#desc.afloor[2].awall)
						end
							lo('??****** NEWPOS:'..tostring(posnew)..'/'..tostring(desc.pos)..':'..tostring(desc.afloor[newfloor].pos)..':'..tostring(desc.afloor[newfloor].base[1])..':'..#desc.afloor[2].awall)
						end
							lo('??****** NEWPOS:'..tostring(posnew)..'/'..tostring(desc.pos)..':'..tostring(desc.afloor[newfloor].pos)..':'..tostring(desc.afloor[newfloor].base[1])..':'..#desc.afloor[2].awall)
						end
							lo('??****** NEWPOS:'..tostring(posnew)..'/'..tostring(desc.pos)..':'..tostring(desc.afloor[newfloor].pos)..':'..tostring(desc.afloor[newfloor].base[1])..':'..#desc.afloor[2].awall)
		end
--            lo('?? if_ARO:'..tostring(dir))
		if dir then goAround(dir) end
	if out.invertedge then
--            lo('?? for_p:'..tostring(out.invertedge.line))
		local p = out.invertedge.line
		local p = out.invertedge.line
--            lo('?? for_oive:'..tostring(p))
		for i = 2,2 do

--        lo('?? for_FW:'..tostring(out.fwhite))
	if out.fcyan then
	if out.middle then
--            lo('?? for_MID:'..tostring(out.middle.line[1])..':'..tostring(out.middle.line[2]))
		debugDrawer:drawLine(out.middle.line[1], out.middle.line[2], ColorF(1,1,1,1))
	if out.middle then
--            lo('?? for_MID:'..tostring(out.middle.line[1])..':'..tostring(out.middle.line[2]))
		debugDrawer:drawLine(out.middle.line[1], out.middle.line[2], ColorF(1,1,1,1))
		if s.areg then
--				U.dump(s.aforest,'>> windowsToggle:'..tostring(s))
			for _,h in pairs(s.areg) do
			end
	--        lo('?? newind:'..tostring(w.doorind))
		end)
local function doorToggle()
	U.dump(cij, '>>--------- doorToggle:'..tostring(cedit.part)..':'..scope)
	local wdesc
			end
	--        lo('?? newind:'..tostring(w.doorind))
		end)
		wdesc = adesc[cedit.mesh].afloor[cij[1]].awall[cij[2]]
				U.dump(wdesc.achild, '?? aCHILD:'..tostring(wdesc.door))
--        wdesc.df[wdesc.door] = {}
	if wdesc ~= nil then
--			U.dump(wdesc.df, '?? for_DF:'..tostring(wdesc.door))
		local list = wdesc.df[wdesc.door]
	markUp(wdesc ~= nil and wdesc.door or nil)
		lo('<< doorToggle:'..tostring(cedit.forest), true)
end
			w.pillar = deepcopy(default.pillar)
--                U.dump(default.pillar,'?? p_new:'..ij[2]..':'..tostring(w.pillar.yes))
		end
		if not w.pillar.yes or not ddae[w.pillar.dae] then return end
--                lo('?? pT:'..tostring(w.pillar.dae)..':'..tostring(ddae[w.pillar.dae]))
		w.pillar.inout = -math.abs(ddae[w.pillar.dae].to.y - ddae[w.pillar.dae].fr.y)/2
		if not w.pillar.yes or not ddae[w.pillar.dae] then return end
--                lo('?? pT:'..tostring(w.pillar.dae)..':'..tostring(ddae[w.pillar.dae]))
		w.pillar.inout = -math.abs(ddae[w.pillar.dae].to.y - ddae[w.pillar.dae].fr.y)/2
--            end
--                lo('?? if_EXT:'.._..':'..tostring(isext),true)
		end
		end
--                U.dump(desc.acorner_, '??****************************** post_REM:'..tostring(dae))
--                    desc.acorner_ = nil
W.hasExtra = function(tp, dobj)
		lo('>> hasExtra:'..tp..':'..tostring(dobj.dae)..':'..tostring(daePath[tp]))
	local function forCorner()
W.hasExtra = function(tp, dobj)
		lo('>> hasExtra:'..tp..':'..tostring(dobj.dae)..':'..tostring(daePath[tp]))
	local function forCorner()
		end
			lo('?? if_corner:'..tostring(pth))
		if pth then
				dobj.margin = dobj.margin/3
--				U.dump(ddae[pth],'?? corner:'..tostring(dobj.margin)..':'..pth)
		end
		local ind = string.find(dobj.dae,'_SC_',1,true)
			U.dump(daePath['stringcourse_corner'],'?? if_IND:'..tostring(ind)..':'..#daePath['stringcourse_corner'])
		if ind then
			local scorner = string.sub(dobj.dae,1,ind-1)..'_Sco_'..string.sub(dobj.dae,ind+4)
				lo('?? if_SC:'..scorner..':'..tostring(ddae[scorner]))
--						local scorner = atkn[1]..'_Sco_'..atkn[2]
						for k,d in pairs(desc.afloor[i].awall) do
--								lo('?? if_POS:'..i..':'..k..':'..tostring(U.proj2D(d.pos))..':'..tostring(p)..':'..tostring(d.pilaster))
							if U.proj2D(d.pos):distance(p) < small_dist and d.pilaster then
						for k,d in pairs(desc.afloor[i].awall) do
--								lo('?? if_POS:'..i..':'..k..':'..tostring(U.proj2D(d.pos))..':'..tostring(p)..':'..tostring(d.pilaster))
							if U.proj2D(d.pos):distance(p) < small_dist and d.pilaster then
						for k,d in pairs(desc.afloor[i].awall) do
--								lo('?? if_POS:'..i..':'..k..':'..tostring(U.proj2D(d.pos))..':'..tostring(p)..':'..tostring(d.pilaster))
							if U.proj2D(d.pos):distance(p) < small_dist and d.pilaster then
			local onside = sameSide(desc.selection)
	--			U.dump(desc.selection, '?? for_PILAST:'..tostring(onside))
			if not onside then return end
	--		local aind = {}
				U.dump(desc.selection,'?? if_SPLiT:'..tostring(W.ui.pilaster_nsplit))
			local p, w
						p = U.proj2D(w.pos)
	--						lo('?? pil_POS:'..tostring(p))
					else
	elseif tp == 'storefront' then
			lo('?? toggle_storefront:'..tostring(cedit), true)
		forBuilding(adesc[cedit.mesh], function(w, ij)
			if w.storefront.yes then w.storefront.adae = {} end
				lo('?? for_SF:'..tostring(w.storefront.yes)..':'..#w.storefront.adae)
			if w.storefront.yes and #w.storefront.adae == 0 then
--	if tp == 'roofborder' then
--		lo('?? forDAE:'..tp..':'..tostring(daePath[tp]))
--	end
--			dbg = true
--			lo('?? ifForest:'..tostring(cedit.forest)..':'..#atp)
--		end
			else
				lo('?? ifForest:'..cedit.forest..':'..tostring(out._dbgcheck))
			end
		if out._dbgcheck then
--			lo('??^^^^^^^^^^^^_______________^^^^^^^^^^^ ifForest:'..#cedit.aforest..':'..tostring(W.forSpline()))
			if #cedit.aforest>0 then
		local dae = out.inhole.achild[out.inhole.achild.cur or #out.inhole.achild].body
--            if atp then lo('?? ifForest.for_hole:'..tostring(dae)) end

--            lo('?? if_hole:'..tostring(atp)..':'..tostring(ddae[dae]))
--            if atp then indrag = true end

--            lo('?? if_hole:'..tostring(atp)..':'..tostring(ddae[dae]))
--            if atp then indrag = true end
		if not atp then
--			lo('?? NO_ATP:'..tostring(cedit.forest))
		end
--		return true
--		lo('?? ifFor:'..tostring(dbg)..':'..tostring(atp and atp[1] or nil))
--[[
--		return true
--		lo('?? ifFor:'..tostring(dbg)..':'..tostring(atp and atp[1] or nil))
--[[
		if #U.index(atp, dforest[cedit.aforest[1] ].type)>0 and W.forSpline() then
			U.dump(atp,'?? for_TRUE:'..tostring(dbg)..':'..tostring(W.out.inhole))
			return true
		if #U.index(atp, dforest[cedit.aforest[1] ].type)>0 and W.forSpline() then
			U.dump(atp,'?? for_TRUE:'..tostring(dbg)..':'..tostring(W.out.inhole))
			return true
--		if atp and atp[1] == 'pilaster' and cedit.forest then
--			lo('?? for_pil:'..tostring(cedit.forest)..':'..#cedit.aforest)
--		end
			if dbg then
				lo('?? dssss:'..cedit.aforest[1]..':'..tostring(dforest[cedit.aforest[1]]))
			end
--			lo('??________*************** ifFor2:')
--			if atp and atp[1]=='gutter' then lo('?? is_FOREST:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest])) end
			if dbg then lo('?? ce_FOR:'..cedit.forest..':'..tostring(#atp)) end
--			lo('??________*************** ifFor2:')
--			if atp and atp[1]=='gutter' then lo('?? is_FOREST:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest])) end
			if dbg then lo('?? ce_FOR:'..cedit.forest..':'..tostring(#atp)) end
--			if atp and atp[1]=='gutter' then lo('?? is_FOREST:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest])) end
			if dbg then lo('?? ce_FOR:'..cedit.forest..':'..tostring(#atp)) end
--			if dbg == 11 and cedit.forest and W.forSpline() then
--			if dbg == 11 and cedit.forest and W.forSpline() then
--				lo('?? iffrrrr2:'..dbg..':'..tostring(cedit.forest)..':'..#cedit.aforest)
--				return true
			if W.ui.dbg and atp[1] == 'corner' then
				U.dump(atp, '?? ifForest:'..tostring(atp)..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]))
			end
			if W.ui.dbg and atp[1] == 'corner' then
				U.dump(atp, '?? ifForest:'..tostring(atp)..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]))
			end
			if W.ui.dbg and atp[1] == 'corner' then
				U.dump(atp, '?? ifForest:'..tostring(atp)..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]))
			end
			if dbg then
--				lo('?? iffor:'..tostring(dforest[cedit.forest]), true)
			end
			end
--            lo('?? ififForest:'..tostring(dforest[cedit.forest].type)..':'..tostring(atp))
			if atp and cedit.forest and atp[1] == 'stringcourse' then
			end
--            lo('?? ififForest:'..tostring(dforest[cedit.forest].type)..':'..tostring(atp))
			if atp and cedit.forest and atp[1] == 'stringcourse' then
--			if atp and cedit.forest and atp[1] == 'roofborder' then
--				lo('?? if_FORS:'..#cedit.aforest..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest])..':'..tostring(dforest[cedit.forest].type))
			end
--			if atp and cedit.forest and atp[1] == 'roofborder' then
--				lo('?? if_FORS:'..#cedit.aforest..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest])..':'..tostring(dforest[cedit.forest].type))
			end
--			if atp and cedit.forest and atp[1] == 'roofborder' then
--				lo('?? if_FORS:'..#cedit.aforest..':'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest])..':'..tostring(dforest[cedit.forest].type))
			end
		if atp == nil then
--			lo('?? focef1:'..tostring(dbg))
			return true
				local dae = out.inhole.achild[out.inhole.achild.cur].body
--                    lo('?? if_hole:'..tostring(atp)..':'..tostring(ddae[dae]))
				if ddae[dae] and ddae[dae].type == atp then
				local dae = out.inhole.achild[out.inhole.achild.cur].body
--                    lo('?? if_hole:'..tostring(atp)..':'..tostring(ddae[dae]))
				if ddae[dae] and ddae[dae].type == atp then
--        if dbg then
--            lo('?? ifforest:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]), true) --..':'..tostring(dforest[cedit.forest].type)..':'..tostring(atp[1]))
--        end
--        if dbg then
--            lo('?? ifforest:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]), true) --..':'..tostring(dforest[cedit.forest].type)..':'..tostring(atp[1]))
--        end
--        if dbg then
--            lo('?? ifforest:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]), true) --..':'..tostring(dforest[cedit.forest].type)..':'..tostring(atp[1]))
--        end
--        if dbg then
--            lo('?? ifforest:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]), true) --..':'..tostring(dforest[cedit.forest].type)..':'..tostring(atp[1]))
--        end
--            if incontrol == 7 then
--                lo('?? iff:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]))
--            end
--            if incontrol == 7 then
--                lo('?? iff:'..tostring(cedit.forest)..':'..tostring(dforest[cedit.forest]))
--            end
	end
    if dbg then U.dump(incorner, '>> ifPairEnd:'..tostring(forhit)..':'..tostring(incorner)..' cij:'..tostring(cij and cij[1] or nil)..':'..tostring(cij and cij[2] or nil), true) end
	if not ij then
	end
    if dbg then U.dump(incorner, '>> ifPairEnd:'..tostring(forhit)..':'..tostring(incorner)..' cij:'..tostring(cij and cij[1] or nil)..':'..tostring(cij and cij[2] or nil), true) end
	if not ij then
	end
    if dbg then U.dump(incorner, '>> ifPairEnd:'..tostring(forhit)..':'..tostring(incorner)..' cij:'..tostring(cij and cij[1] or nil)..':'..tostring(cij and cij[2] or nil), true) end
	if not ij then
	end
    if dbg then U.dump(incorner, '>> ifPairEnd:'..tostring(forhit)..':'..tostring(incorner)..' cij:'..tostring(cij and cij[1] or nil)..':'..tostring(cij and cij[2] or nil), true) end
	if not ij then
      if dbg then
        U.dump(apair, '?? ifPairEnd_PAIRS:'..tostring(forhit))
      end
--            local adata,apair = T.forGable(floor.base)
                if dbg then U.dump(apair,'?? if_pairs_end:'..tostring(forhit)..':'..ij[2]..':'..tostring(isHit(ij[2],apair[1]))) end
    if apair then
--            local adata,apair = T.forGable(floor.base)
                if dbg then U.dump(apair,'?? if_pairs_end:'..tostring(forhit)..':'..ij[2]..':'..tostring(isHit(ij[2],apair[1]))) end
    if apair then
          end
              if dbg then U.dump(apair[i],'?? if_FIT:'..ij[2]..':'..tostring(ifit)) end
          if ifit then
					local fit = forhit and isHit(ij[2],apair[i]) or isFit(ij[2],apair[i])
							if dbg then U.dump(apair[i],'?? for_FIT:'..tostring(fit)..':'..ij[2]) end
					if fit then
				elseif isFit(cij[2],apair[#apair]) then
	--                U.dump(apair, '?? isPairEnd:'..cij[1]..':'..tostring(cij[2]), true)
					return (incorner and 1 or 2),apair[#apair]

--        lo('?? ifRoof:'..tostring(nm))
	local floor = adesc[cedit.mesh].afloor[cij[1]]
			if W.ui.dbg then
				lo('??^^^^^^^^^^^^^^^^^^^^^^ child_BASE0:'..nm..':'..tostring(floor.top.cchild)..':'..#floor.top.achild)
--                W.ui.dbg = nil
		if cedit.mesh == nil or adesc[cedit.mesh] == nil then
			lo('!! ERR_ifRoof:'..nm..':'..tostring(cedit.mesh))
			return false
--        _dbdrag = true
--        lo('??*** ifgable:'..tostring(isRect(base)))
--[[
		if not (base and (#base == 4 or #base == 6) and isRect(base)) then
			lo('!! noBB:'..#base..':'..tostring(isRect(base)))
		end
			if out.inridge then
				U.dump(desctop, '??___________________________________________ for_DESC:'..tostring(floor.top.cchild))
				out.inridge = false
]]
--        U.dump(floor.top, '>> ifTopRect:'..tostring(cij[1]))
end
					local pchild = cbase[k][ic] --c.base[ic]
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
--                        lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
					local pchild = cbase[k][ic] --c.base[ic]
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
--                        lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
					local pchild = cbase[k][ic] --c.base[ic]
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
--                        lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
--                        lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
					-- if child vertex belongs to wall edge
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
--                        lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
					-- if child vertex belongs to wall edge
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
--                        lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
					-- if child vertex belongs to wall edge
--                            if k == 2 then
--                                lo('?? move_c_base: child:'..k..' ind:'..ic..':'..ib..'/'..j..':'..tostring(pchild)..' v:'..tostring(v)..':'..val)
--                            end
--                            if k == 2 then
--                                lo('?? move_c_base: child:'..k..' ind:'..ic..':'..ib..'/'..j..':'..tostring(pchild)..' v:'..tostring(v)..':'..val)
--                            end
--                            end
--                            U.dump(cbase,'?? move_c_base: child:'..k..':'..ib..'/'..j..':'..ic..':'..tostring(pchild))
						if toemu then
--        U.dump(buf, '>> extrude:')
		lo('>> extrude:'..tostring(rebased), true)
	if not sameSide(buf) then return end
--    if tableSize(buf) > 1 or not sameSide(buf) then return end
--            U.dump(buf, '>> extrude:'..tostring(rebased))
--            U.dump(asbase, '?? asbase:')
--                    lo('?? post_INS:'..#floor.awall,true)
--            U.dump(floor.base, '?? new_base:'..tostring(v))
--                U.dump(r, '?? newbuf:')
		end
--                U.dump(r, '?? extr_FLOOR:'..i..':'..tostring(val))
		-- move base
			-- walls to move
--                    lo('?? to_move:'..tostring(i)..':'..tostring(asbase[i]))
--                lo('?? to_move:'..j, true)
			-- walls to move
--                    lo('?? to_move:'..tostring(i)..':'..tostring(asbase[i]))
--                lo('?? to_move:'..j, true)
							local pchild = acbase[i][k][ic] --c.base[ic]
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
								lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
							local pchild = acbase[i][k][ic] --c.base[ic]
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
								lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
							local pchild = acbase[i][k][ic] --c.base[ic]
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
								lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
								lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
							-- if child vertex belongs to wall edge
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
								lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
							-- if child vertex belongs to wall edge
--                                lo('?? if_at:'..tostring(pchild)..':'..tostring(base[j])..':'..tostring(U.mod(j+1,base)))
								lo('?? if_at:'..tostring(pchild)..':'..tostring(vb)..':'..tostring(ve))
							-- if child vertex belongs to wall edge
							if math.abs((vb-pchild):length()+(ve-pchild):length()-(vb-ve):length()) < small_dist then
									U.dump(acbase[i][k],'?? move_c_base:'..ib..':'..ic..':'..tostring(pchild))
								c.base[ic] = acbase[i][k][ic] + v*val
				local un = w.u:normalized()
					U.dump(av, '?? h_IVERTS:'..tostring(w.u)..':'..tostring(dmesh[w.id]))
				for _,v in pairs(av) do
				local un = w.u:normalized()
					U.dump(av, '?? h_IVERTS:'..tostring(w.u)..':'..tostring(dmesh[w.id]))
				for _,v in pairs(av) do
				for _,v in pairs(av) do
	--                    lo('?? for_v:'..tostring(m.verts[v+1]))
					m.verts[v+1] = m.verts[v+1] + un*val
--	local xml = M.xmlOn(editor.getLevelPath()..'bat/'..'exp_22762.dae')
		lo('?? mat2xml.for_node:'..tostring(xml))
--		for i,k in pairs(xml.kids) do
		local afi = {}
		--		lo('?? pre_build:'..tostring(desc)..':'..tostring(tableSize(editor.selection)))
--			lo('?? for_desc:'..tostring())
		local afi = {}
		--		lo('?? pre_build:'..tostring(desc)..':'..tostring(tableSize(editor.selection)))
--			lo('?? for_desc:'..tostring())
		--		lo('?? pre_build:'..tostring(desc)..':'..tostring(tableSize(editor.selection)))
--			lo('?? for_desc:'..tostring())
		aid[#aid+1] = desc.id
		editor.selectObjects(aid, editor.SelectMode_Add)
--		lo('?? daeExport:'..#aid..':'..#afi..':'..tostring(tableSize(editor.selection))) --..':'..tostring(editor.selection.forestItem))--..':'..tostring(aid[1])..':'..tostring(editor.selection.object.id)..':'..tostring(tableSize(editor.selection)))
--		scope = nil
		editor.selectObjects(aid, editor.SelectMode_Add)
--		lo('?? daeExport:'..#aid..':'..#afi..':'..tostring(tableSize(editor.selection))) --..':'..tostring(editor.selection.forestItem))--..':'..tostring(aid[1])..':'..tostring(editor.selection.object.id)..':'..tostring(tableSize(editor.selection)))
--		scope = nil
		editor.selectObjects(aid, editor.SelectMode_Add)
--		lo('?? daeExport:'..#aid..':'..#afi..':'..tostring(tableSize(editor.selection))) --..':'..tostring(editor.selection.forestItem))--..':'..tostring(aid[1])..':'..tostring(editor.selection.object.id)..':'..tostring(tableSize(editor.selection)))
--		scope = nil
		editor.selectObjects(aid, editor.SelectMode_Add)
--		lo('?? daeExport:'..#aid..':'..#afi..':'..tostring(tableSize(editor.selection))) --..':'..tostring(editor.selection.forestItem))--..':'..tostring(aid[1])..':'..tostring(editor.selection.object.id)..':'..tostring(tableSize(editor.selection)))
--		scope = nil
		editor.selectObjects(aid, editor.SelectMode_Add)
--		lo('?? daeExport:'..#aid..':'..#afi..':'..tostring(tableSize(editor.selection))) --..':'..tostring(editor.selection.forestItem))--..':'..tostring(aid[1])..':'..tostring(editor.selection.object.id)..':'..tostring(tableSize(editor.selection)))
--		scope = nil
						local rot = trans:toEuler() -- need Z
			--					lo('?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
						local rot = trans:toEuler() -- need Z
			--					lo('?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
						local rot = trans:toEuler() -- need Z
			--					lo('?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
						local rot = trans:toEuler() -- need Z
			--					lo('?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--					lo('?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(trans,'?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale))
			--					lo('?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(trans,'?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale))
			--					lo('?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(trans,'?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale))
			--					lo('?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(trans,'?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale))
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(trans,'?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale))
						local oid,om = f2m(pth, id)
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(trans,'?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale))
						local oid,om = f2m(pth, id)
			--                    U.dump(editor.matrixToTable(item:getTransform()), '?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale)..':'..tostring(rot))
			--                    U.dump(trans,'?? for_fi:'..tostring(item)..':'..tostring(pos)..':'..tostring(scale))
						local oid,om = f2m(pth, id)
local function onVal(key, val)
--		lo('?? onVal:'..key..':'..tostring(val))
		if not incontrol then U.dump(cij, '?? W.onVal:'..tostring(key)..':'..tostring(val)) end --..':'..tostring(out.inseed)..':')
--		lo('?? onVal:'..key..':'..tostring(val))
		if not incontrol then U.dump(cij, '?? W.onVal:'..tostring(key)..':'..tostring(val)) end --..':'..tostring(out.inseed)..':')
	local sval = W.ui[key]
--		lo('?? onVal:'..key..':'..tostring(val))
		if not incontrol then U.dump(cij, '?? W.onVal:'..tostring(key)..':'..tostring(val)) end --..':'..tostring(out.inseed)..':')
	local sval = W.ui[key]
--		lo('?? onVal:'..key..':'..tostring(val))
		if not incontrol then U.dump(cij, '?? W.onVal:'..tostring(key)..':'..tostring(val)) end --..':'..tostring(out.inseed)..':')
	local sval = W.ui[key]
	elseif key == 'gen_unique' then
--			print('?? BRAD:'..tostring(W.ui.build_radius))
--			if true then return end
		local amesh = FS:findFiles(pth, '*.dae', -1, true, false)
			lo('?? onVal_gen_unique:'..tostring(pth)..':'..tableSize(amesh))
		-- clean folder
		-- generate
			lo('?? to_GEN:'..W.ui.build_gen..':'..tostring(L)..':'..tostring(tb))
		local ashape = {'l_shape',
		-- generate
			lo('?? to_GEN:'..W.ui.build_gen..':'..tostring(L)..':'..tostring(tb))
		local ashape = {'l_shape',
			p.z = z
				lo('?? for_BASE:'..i..':'..tableSize(base)..':'..tostring(p))
			buildingGen(p, base, true)
				local om = scenetree.findObjectById(tonumber(o))
					lo('?? if_DEL:'..tostring(o)..':'..tostring(om))
				if om then
				local om = scenetree.findObjectById(tonumber(o))
					lo('?? if_DEL:'..tostring(o)..':'..tostring(om))
				if om then
				if not dpos[id] then dpos[id] = {} end
				om:registerObject(nm) --'tmp_'..tostring(os.clock()))
					lo('?? for_DAE:'..tostring(om.obj)..':'..nm..':'..id) --..':'..om.__parent)
				om:registerObject(nm) --'tmp_'..tostring(os.clock()))
					lo('?? for_DAE:'..tostring(om.obj)..':'..nm..':'..id) --..':'..om.__parent)
				groupBat:add(om.obj)
			for _,p in pairs(dpos[d.id]) do
				lo('?? topos:'..d.id..':'..tostring(p))
				forBuilding(d, function(w, ij)
		local jdata = jsonEncode({jdata = adesc})
			lo('?? ss:'..#jdata..':'..tostring(editor.getLevelPath()))
	--    local ifdir = FS:findFiles(dirname, "*", -1, true, false)
	--      lo('?? ifdir:'..tostring(ifdir))
	--    if not ifdir then
			function(data)
					lo('?? to_path:'..tostring(data.filepath))
				local fname = data.filepath -- editor.getLevelPath()..'bat.json'
		--        worldEditorCppApi.colladaExportSelection(data.filepath)
		--        lo('?? editor_fileDialog:'..tostring(data.filepath))
		--        M.matReplace(data.filepath) --,'mat_dummy')
		else
				lo('?? dae_exp:'..tableSize(adesc)..':'..tostring(W.out.inperftest))
--			W.persist()
				local nm = 'b_'..d.id
					lo('??+++ for_DESC:'..nm..':'..tostring(d.data and #d.data or nil))
				if cedit and d.id == cedit.mesh then
					-- procedural to static
						lo('?? pre_DOWN:'..d.id..':'..tostring(scope))
					W.houseDown(d, not W.out.inperftest and true or false)
				om:setField('shapeName', 0, batdir..nm..'.dae')
--					lo('?? for_DAE:'..tostring(om.obj)) --..':'..om.__parent)
				om:registerObject(nm) --'tmp_'..tostring(os.clock()))
--					lo('?? for_DAE:'..tostring(om.obj)) --..':'..om.__parent)
				om:registerObject(nm) --'tmp_'..tostring(os.clock()))
				groupEdit:add(om.obj)
			end
				lo('?? deld:'..tostring(scope))
			for _,nm in pairs(list) do
					om:setField('shapeName', 0, batdir..nm..'.dae')
--						lo('?? for_DAE:'..tostring(om.obj)) --..':'..om.__parent)
					om:registerObject(nm) --'tmp_'..tostring(os.clock()))
--						lo('?? for_DAE:'..tostring(om.obj)) --..':'..om.__parent)
					om:registerObject(nm) --'tmp_'..tostring(os.clock()))
					groupBat:add(om.obj)
--				require 'paths'
--					lo('?? id_BAT:'..tostring(FS:directoryExists(dname)))
				if not FS:directoryExists(dname) then
					local jdesc = jsonDecode(jbody)
						lo('?? desc_loaded:'..tostring(tableSize(jdesc['jdata'])))
					file:close()
					local aid = W.recover(jdesc['jdata'], function()
						lo('?? recovered:'..tostring(#jdesc))
			--        unrequire(apack[2])
				local jdesc = jsonDecode(jbody)
				lo('?? desc_saved:'..tostring(tableSize(jdesc['jdata'])))
				file:close()
				W.recover(jdesc['jdata'], function()
				lo('?? recovered:'..tostring(#jdesc))
		--        unrequire(apack[2])
		out.inseed = not out.inseed
			lo('?? in_seed:'..tostring(out.inseed))
--        W.ui[key] = out.inseed
		--        incontrol = true
				lo('?? for_TEST:'..tostring(W.out.testOM.id))
				local obj = scenetree.findObjectById(W.out.testOM.id)
				end
		--                U.dump(floor.top,'?? if_TOP:'..tostring(floor.top.id))
				objDown(floor.top)
				aedit = {}
	--            lo('?? to_CHILD_id:'..tostring(ftgt.achild[cedit.cval['DragVal'].tochild].id))
				houseUp(nil, ftgt.achild[cedit.cval['DragVal'].tochild].id)
			else
				lo('!! child_height_NO_TARGET:'..tostring(cij[1]))
			end
			end
--                    lo('?? new_EDIT:'..tostring(cedit.mesh))
			return
							if (a-b):length() < small_dist then
								lo('?? match:'..i..':'..j..':'..tostring(a))
								out.avedit[#out.avedit+1] = a
--        incontrol = true
--        lo('?? for_TEST:'..tostring(W.out.testID))
		if false and U._PRD == 0 then
			if w.doorind then
--                    lo('?? for_DOOR:'..ij[1]..':'..ij[2]..':'..w.doorind..':'..tostring(daePath['stairs']))
				if not w.doorstairs then
		desc.basement.yes = not desc.basement.yes
			lo('??______ for_basement:'..tostring(desc.basement.yes))
		if desc.basement.yes then
			local floorpre = desc.afloor[1]
	--            U.dump(desc.afloor[1].awall[1], '?? floor_PRE:'..tostring(desc.afloor[2].pos))
			local floor = {ij = {1}, base = deepcopy(desc.afloor[1].base), pos = floorpre.pos,
		end
			lo('?? pre_ridged:'..tostring(floor.top.id)..':'..#floor.top.achild..':'..tostring(floor.top.achild[1]))
--            U.dump(floor.top.achild[1], '?? pre_ridged:'..tostring(floor.top.id))
		end
			lo('?? pre_ridged:'..tostring(floor.top.id)..':'..#floor.top.achild..':'..tostring(floor.top.achild[1]))
--            U.dump(floor.top.achild[1], '?? pre_ridged:'..tostring(floor.top.id))
			lo('?? pre_ridged:'..tostring(floor.top.id)..':'..#floor.top.achild..':'..tostring(floor.top.achild[1]))
--            U.dump(floor.top.achild[1], '?? pre_ridged:'..tostring(floor.top.id))
		if #floor.top.achild == 1 then
		end)
--        lo('?? ifSC:'..tostring(ifForest({'stringcourse'})))
	elseif key == 'pilaster_ind0' then
				dae = w.pilaster.dae
					U.dump(w.pilaster.aind, '??___________ AIND:'..ij[1]..':'..ij[2]..tostring(cedit.mesh)..':'..tostring(cij[2]))
			end
				dae = w.pilaster.dae
					U.dump(w.pilaster.aind, '??___________ AIND:'..ij[1]..':'..ij[2]..tostring(cedit.mesh)..':'..tostring(cij[2]))
			end
			W.ui.dbg = true
			lo('?? cij:'..tostring(cij[1])..':'..tostring(cij[2]))
	elseif key == 'mesh_apply' then
			W.ui.dbg = true
			lo('?? cij:'..tostring(cij[1])..':'..tostring(cij[2]))
	elseif key == 'mesh_apply' then
	elseif key == 'mesh_apply' then
--        lo('?? MA:'..tostring(dforest[cedit.forest].type), true)
		local tp = #cedit.aforest>0 and dforest[cedit.aforest[1]].type or dforest[cedit.forest].type
			indrag = false
			lo('?? for_ci:'..tostring(val))
		return
		local floor = adesc[cedit.mesh].afloor[cij[1]]
--            lo('?? ANG_TOP:'..tostring(floor.top.cchild), true)
		local id
			local desctop = forTop()
				lo('?? roof_border:'..cij[1]..':'..tostring(desctop)) --..':'..cij[2])
			if desctop then
				desctop.border.yes = not desctop.border.yes
--					lo('?? if_RB:'..tostring(desctop.border.yes))
			end
		end
--            lo('?? roof_border:'..tostring(floor.top.border.yes))
	elseif key == 'roof_ridge' then
				lo('??____^^^^^^^ ridge_UP:'..#floor.top.achild,true)
--            lo('?? in_RIDGE:'..tostring(out.inridge)..':'..#av..':'..#af)
	elseif key == 'hole_pull' then
			local doorW = ddae[b.body].to.x - ddae[b.body].fr.x
--                lo('?? hole_fitmesh.WH:'..tostring(doorH)..':'..tostring(doorW))
--                            U.dump(b.base, '??______ for_hole_mesh:'.._..':'..b.body..':'..ang..':'..tostring(desc.pos))
			local doorW = ddae[b.body].to.x - ddae[b.body].fr.x
--                lo('?? hole_fitmesh.WH:'..tostring(doorH)..':'..tostring(doorW))
--                            U.dump(b.base, '??______ for_hole_mesh:'.._..':'..b.body..':'..ang..':'..tostring(desc.pos))
--                lo('?? hole_fitmesh.WH:'..tostring(doorH)..':'..tostring(doorW))
--                            U.dump(b.base, '??______ for_hole_mesh:'.._..':'..b.body..':'..ang..':'..tostring(desc.pos))
			local scale = vec3(doorW/w, 1, doorH/h)
--                U.dump('?? scale:'..tostring(scale))
			b.base[1].y = b.base[2].y + h*scale.z
		if out.inhole and out.inhole.achild then
--                U.dump(out.inhole.arc, '?? hole_x:'..cedit.mesh..':'..tostring(aedit[cedit.mesh]))
			local ahole = out.inhole.achild
--                    local irc = U.inRC(base[1] + val*vec3(1,0,0), {out.inhole.arc[6]})
--                    U.dump(out.inhole.arc[6], '?? if_RC:'..tostring(irc)..':'..tostring(base[1]))
--                    U.dump(out.inhole.arc[6], '?? if_RC:'..tostring(irc)..':'..tostring(base[1]), true)
--                    local irc = U.inRC(base[1] + val*vec3(1,0,0), {out.inhole.arc[6]})
--                    U.dump(out.inhole.arc[6], '?? if_RC:'..tostring(irc)..':'..tostring(base[1]))
--                    U.dump(out.inhole.arc[6], '?? if_RC:'..tostring(irc)..':'..tostring(base[1]), true)
--                    U.dump(out.inhole.arc[6], '?? if_RC:'..tostring(irc)..':'..tostring(base[1]))
--                    U.dump(out.inhole.arc[6], '?? if_RC:'..tostring(irc)..':'..tostring(base[1]), true)
--                        lo('?? if_in:'..i..':'..tostring(ind)..':'..#out.inhole.arc)
--                    U.dump(out.inhole.arc[6], '?? if_RC:'..tostring(irc)..':'..tostring(base[1]))
--                    U.dump(out.inhole.arc[6], '?? if_RC:'..tostring(irc)..':'..tostring(base[1]), true)
--                        lo('?? if_in:'..i..':'..tostring(ind)..':'..#out.inhole.arc)
--                    U.dump(out.inhole.arc[6], '?? if_RC:'..tostring(irc)..':'..tostring(base[1]), true)
--                        lo('?? if_in:'..i..':'..tostring(ind)..':'..#out.inhole.arc)
--                        lo('?? rollback:'..U.inRC(base[i], out.inhole.arc), true)
		forBuilding(desc, function(w, ij)
--                lo('?? for_floor:'..ij[1]..':'..tostring(desc.afloor[ij[1]].top.achild), true)
			if cfloor == ij[1] then return end
--                    base = c.base
--                        lo('?? if_RIDGE:'..tostring(c.ridge))
--                        if c.ridge then
--                        if c.ridge then
--                            lo('?? if_RIDGE2:'..tostring(c.ridge.on))
--                        end
		local ij = scope == 'floor' and {cij[1]} or cij
			U.dump(ij, '?? fringe_io:'..tostring(scope))
		forBuilding(desc, function(w, ij)
	elseif key == 'flip_axis' then
--            lo('?? flip_ax:'..key..':'..tostring(sval)..':'..val, true)
		if val > sval then
								for b,ic in pairs(c.base) do
										lo('?? if_cross:'..a..':'..isel..':'..b..':'..tostring(abase[f][isel]))
									local e1,e2 = c.base[b],U.mod(b+1, c.base)
--            [floor.top.cchild].dirty = true
--            U.dump(desc.selection,'?? to_pull2:'..tostring(desc.afloor[cij[1]].top.shape),true)
--            U.dump(desc.selection, '?? to_extr:'..val)
				end
--                lo('?? to_del:'..j..':'..tostring(w.id), true)
--                scenetree.findObjectById(w.id):delete()
						end
							lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ to_UPD:'..d.key..':'..tostring(incontrol))
--							d.p = cedit.cval['DragPos'].p + 1*(val-cedit.cval['DragPos'].val)*vec3(1.5,1) -- d.p + 0.2*vec3(1,1)
			if cedit.fscope == 1 then
		--          U.dump(w['win'..'_inf'], '?? for_winf:'..tostring(cedit.forest)..':'..ij[1]..':'..ij[2])
		--          U.dump(w.df, '?? for_winfDF:'..tostring(cedit.forest))
		--          U.dump(w['win'..'_inf'], '?? for_winf:'..tostring(cedit.forest)..':'..ij[1]..':'..ij[2])
		--          U.dump(w.df, '?? for_winfDF:'..tostring(cedit.forest))
		--            lo('?? if_IND:'..dforest[cedit.forest].ind,true)
		if s then
--				U.dump(s, '?? ws_SPLINE:'..tostring(s.default)..':'..val)
			if s.default then
			if s.default then
--					U.dump(ddae[s.def['win'].dae], '?? dae_WIN:'..tostring(s.default))
				s.def['win'].padding = val
			local winW = (ddae[w.win].to.x - ddae[w.win].fr.x)*(w.df[w.win] and w.df[w.win].scale or 1)
--				lo('?? if_LEFT:'..tostring(w.winleft))
			local aval = w.u:length() - 2*(w.winleft or 0)
		end
			lo('?? win_SPACE:'..tostring(ifForest({'win'}))..':'..tostring(cedit.forest))
	elseif key == 'win_left' then
		end
			lo('?? win_SPACE:'..tostring(ifForest({'win'}))..':'..tostring(cedit.forest))
	elseif key == 'win_left' then
		local floor = desc.afloor[cij[1]]
--        lo('?? if_child:'..tostring(floor.top.cchild), true)
		if floor.top.cchild then
	end
--        lo('?? onVal_out:'..tostring(cedit.forest)..':'..tostring(ifForest({'stringcourse'})), true)
--        lo('??^^^^^^^^^^^^^^^ onV_HU:')
	end
--        lo('?? onVal_out:'..tostring(cedit.forest)..':'..tostring(ifForest({'stringcourse'})), true)
--        lo('??^^^^^^^^^^^^^^^ onV_HU:')
	end
--		lo('?? ^^^___ if_FTYPE:'..tostring(ftype)..':'..scope)
	houseUp(desc, cedit.mesh, true)
	houseUp(desc, cedit.mesh, true)
--        lo('?? onVal_out2:'..tostring(cedit.forest)..':'..tostring(W.ifForest({'win'}))..':'..tostring(W.ifForest({'pillar'}, true)), true)
--		lo('?? onVal.if_FOREST:'..tostring(ftype)..':'..tostring(cedit.forest)..':'..#cedit.aforest..':'..tostring(ifForest({'win'},1))) --dforest[cedit.forest].type))
	houseUp(desc, cedit.mesh, true)
--        lo('?? onVal_out2:'..tostring(cedit.forest)..':'..tostring(W.ifForest({'win'}))..':'..tostring(W.ifForest({'pillar'}, true)), true)
--		lo('?? onVal.if_FOREST:'..tostring(ftype)..':'..tostring(cedit.forest)..':'..#cedit.aforest..':'..tostring(ifForest({'win'},1))) --dforest[cedit.forest].type))
	houseUp(desc, cedit.mesh, true)
--        lo('?? onVal_out2:'..tostring(cedit.forest)..':'..tostring(W.ifForest({'win'}))..':'..tostring(W.ifForest({'pillar'}, true)), true)
--		lo('?? onVal.if_FOREST:'..tostring(ftype)..':'..tostring(cedit.forest)..':'..#cedit.aforest..':'..tostring(ifForest({'win'},1))) --dforest[cedit.forest].type))
--        lo('?? onVal_out2:'..tostring(cedit.forest)..':'..tostring(W.ifForest({'win'}))..':'..tostring(W.ifForest({'pillar'}, true)), true)
--		lo('?? onVal.if_FOREST:'..tostring(ftype)..':'..tostring(cedit.forest)..':'..#cedit.aforest..':'..tostring(ifForest({'win'},1))) --dforest[cedit.forest].type))
	if ftype then
--        lo('?? onVal_out2:'..tostring(cedit.forest)..':'..tostring(W.ifForest({'win'}))..':'..tostring(W.ifForest({'pillar'}, true)), true)
--		lo('?? onVal.if_FOREST:'..tostring(ftype)..':'..tostring(cedit.forest)..':'..#cedit.aforest..':'..tostring(ifForest({'win'},1))) --dforest[cedit.forest].type))
	if ftype then
--        lo('?? onVal_out2:'..tostring(cedit.forest)..':'..tostring(W.ifForest({'win'}))..':'..tostring(W.ifForest({'pillar'}, true)), true)
--		lo('?? onVal.if_FOREST:'..tostring(ftype)..':'..tostring(cedit.forest)..':'..#cedit.aforest..':'..tostring(ifForest({'win'},1))) --dforest[cedit.forest].type))
	if ftype then
				if ftype == 'gutter' and w[ftype] then
--						lo('?? if_DAE:'..tostring(w[ftype].dae)..':'..ftype)
					cedit.forest = w.df[W.pref2dae(w[ftype].dae)][1]
	end
		lo('<< onVal:'..tostring(key)..':'..tostring(dforest[cedit.forest] and dforest[cedit.forest].type or nil),true) --..tostring(out.inbalcony)..':'..tostring(ifForest({'stringcourse'},true))..':'..tostring(cedit.forest), true)
	markUp(dae)
	end
		lo('<< onVal:'..tostring(key)..':'..tostring(dforest[cedit.forest] and dforest[cedit.forest].type or nil),true) --..tostring(out.inbalcony)..':'..tostring(ifForest({'stringcourse'},true))..':'..tostring(cedit.forest), true)
	markUp(dae)
	end
		lo('<< onVal:'..tostring(key)..':'..tostring(dforest[cedit.forest] and dforest[cedit.forest].type or nil),true) --..tostring(out.inbalcony)..':'..tostring(ifForest({'stringcourse'},true))..':'..tostring(cedit.forest), true)
	markUp(dae)
	end
		lo('<< onVal:'..tostring(key)..':'..tostring(dforest[cedit.forest] and dforest[cedit.forest].type or nil),true) --..tostring(out.inbalcony)..':'..tostring(ifForest({'stringcourse'},true))..':'..tostring(cedit.forest), true)
	markUp(dae)
	end
		lo('<< onVal:'..tostring(key)..':'..tostring(dforest[cedit.forest] and dforest[cedit.forest].type or nil),true) --..tostring(out.inbalcony)..':'..tostring(ifForest({'stringcourse'},true))..':'..tostring(cedit.forest), true)
	markUp(dae)
			local iffor = ifForest({'win'},true)
			lo('?? iff_win:'..tostring(iffor)..':'..tostring(cedit.forest),true)
		end
			local iffor = ifForest({'win'},true)
			lo('?? iff_win:'..tostring(iffor)..':'..tostring(cedit.forest),true)
		end
]]
	--..tostring(dforest[cedit.forest].type)..':'
--    indrag = false
@/lua/ge/extensions/flowgraph/nodes/scene/rectMarker.lua
    im.Text("Trigger Name")
    ui_flowgraph_editor.tooltip("Trigger Name: " .. tostring(self.triggerName))
  end
  for i = 0, 3 do
    local name = "rectMarker_" .. tostring(os.time()) .. "_" .. self.id .. "_" .. i
    table.insert(self.markerObjects, self:createCornerMarker(name))
    --create Trigger
    local name = "rectMarkerTrigger_" .. tostring(os.time()) .. "_" .. self.id
    local checkPoint = createObject('BeamNGTrigger')
@/lua/ge/extensions/editor/api/objectHistoryActions.lua
local function changeObjectFieldWithUndo(objIds, fieldName, newFieldValue, arrayIndex)
  if arrayIndex and arrayIndex >= 0 then arrayIndex = tostring(arrayIndex) elseif not arrayIndex then arrayIndex = "" end
  local oldFieldValues = {}
local function changeObjectFieldMultipleValuesWithUndo(objIds, fieldName, newFieldValues, arrayIndex)
  if arrayIndex and arrayIndex >= 0 then arrayIndex = tostring(arrayIndex) elseif not arrayIndex then arrayIndex = "" end
  local oldFieldValues = {}
local function changeObjectFieldWithOldValues(objIds, fieldName, newFieldValue, oldFieldValues, arrayIndex)
  if arrayIndex and arrayIndex >= 0 then arrayIndex = tostring(arrayIndex) elseif not arrayIndex then arrayIndex = "" end
  editor.history:commitAction("ChangeField", {objectIds = objIds, fieldName = fieldName, arrayIndex = arrayIndex, oldFieldValues = oldFieldValues, newFieldValue = newFieldValue}, changeObjectFieldUndo, changeObjectFieldRedo)
@/lua/ge/extensions/editor/decalEditor.lua
local function cellKey(ix, iy, iz)
  return tostring(ix) .. "|" .. tostring(iy) .. "|" .. tostring(iz)
end
local function cellKey(ix, iy, iz)
  return tostring(ix) .. "|" .. tostring(iy) .. "|" .. tostring(iz)
end
local function cellKey(ix, iy, iz)
  return tostring(ix) .. "|" .. tostring(iy) .. "|" .. tostring(iz)
end
      debugDrawer:drawTextAdvanced(inst.position, String('Name: ' .. inst.template:getName()), ColorF(1,1,1,1), true, false, ColorI(0,0,0,192))
      debugDrawer:drawTextAdvanced(inst.position, String('ID: ' .. tostring(inst.id)), ColorF(1,1,1,1), true, false, ColorI(0,0,0,192))
      debugDrawer:drawTextAdvanced(inst.position, String('Dist: ' .. string.format("%0.1f", dist) .. ' m'), ColorF(1,1,1,1), true, false, ColorI(0,0,0,192))
    im.NextColumn()
    im.TextUnformatted(tostring(selectedInstance.id))
    im.NextColumn()
    im.NextColumn()
    im.TextUnformatted(tostring(selectedInstance.uid))
    im.NextColumn()
@/lua/vehicle/energyStorage.lua
    else
      log("E", "energyStorage.init", "Can't find energyStorage directory: " .. tostring(directory))
    end
@/lua/common/libs/LuaIRC/util.lua
    colornum = type(colornum) == "string" and assert(color[colornum], "Invalid color '"..colornum.."'") or colornum
    return table.concat{colByte, tostring(colornum), text, colByte}
end})
@/lua/common/libs/luamqtt/mqtt/client.lua
		else
			error("unexpected key in client args: "..key.." = "..tostring(value))
		end
		if not handlers then
			error("invalid event '"..tostring(event).."' to handle")
		end
	if not handlers then
		error("invalid event '"..tostring(event).."' to handle")
	end
	if not handlers then
		error("invalid event '"..tostring(event).."' to handle")
	end
	if not ok then
		err = "failed to resume receive packet coroutine: "..tostring(packet)
		self:handle("error", err, self)
	end
	local data = tostring(packet)
	local len = data:len()
function client_mt:__tostring()
	return str_format("mqtt.client{id=%q}", tostring(self.args.id))
end
@/lua/ge/extensions/editor/barriersEditor.lua
  local mult = highlight and 1 or 0.3
  debugDrawer:drawTextAdvanced(prefab.center, String(tostring(prefab.filename)), ColorF(1,1,1,1*mult), true, false, ColorI(0,0,0,220*mult))
@/lua/ge/extensions/editor/flowgraph/overview.lua
  if im.BeginPopup("nodeOverviewPopup") then
    if self.contextMenuNode and im.MenuItem1('Focus##' .. tostring("self_id")) then
      self:selectNode(self.contextMenuNode, false)
    end
    if self.contextMenuNode and im.MenuItem1('Delete##' .. tostring("self_id")) then
      self.mgr.graph:deleteNode(self.contextMenuNode)
    im.Separator()
    if im.MenuItem1('Copy##' .. tostring("self_id")) then
    end
    if im.MenuItem1('Paste##' .. tostring("self_id")) then
  if editor.getPreference("flowgraph.debug.displayIds") then
    txt = txt .. ' (' .. tostring(graph.id) .. ')'
  end
  --im.SameLine()
  --im.TextColored(im.ImVec4(1,0.6,0,1), '[' .. tostring(tableSize(graph.nodes)) .. ']')
  --selectThisGraph = selectThisGraph or im.IsItemClicked()
      if node.nodeType ~= "macro/integrated" then
        if im.ImGuiTextFilter_PassFilter(self.filter, tostring(node.id)) or im.ImGuiTextFilter_PassFilter(self.filter, node.name) or self.passedGraphIds[node.graph.id] then
          local txt = node.name
              self.contextMenuNode = node
              im.OpenPopup("nodeOverviewPopup" .. tostring("self_id"))
            end
@/lua/ge/extensions/util/decalRoadsEditor.lua
          debugDrawer:drawSphere(n.pos, n.radius, ColorF(1,0,0, 0.1 * vis))
          --debugDrawer:drawText(pp, String(tostring(nid)), ColorF(0,0,0,1))
          if lastData then
@/lua/ge/extensions/core/levels.lua
    if FS:directoryExists(newName) then
      log('D', '', 'converting level argument to new format: ' .. tostring(levelPath) .. ' > ' .. tostring(newName))
      levelPath = newName
    if FS:directoryExists(newName) then
      log('D', '', 'converting level argument to new format: ' .. tostring(levelPath) .. ' > ' .. tostring(newName))
      levelPath = newName
    if not expandedLevelPath or expandedLevelPath == "" then
      log('E', '', 'Expanded mission file is invalid: "'..dumps(expandedLevelPath)..'" from "'..tostring(levelPath)..'"')
      core_gamestate.requestExitLoadingScreen('')
@/lua/ge/extensions/flowgraph/modules/uiModule.lua
    { text = "" },
    { text = tostring(totalTiersScore) .. " points", styling = {totalRow = true} },
    order = 1000
    { text = "" },
    { text = tostring(totalDriftEventsScore) .. " points",  styling = {totalRow = true}  },
  })
@/lua/common/tech/techCommunication.lua
  if err then
    log('E', logTag, 'Error reading from socket: ' .. tostring(err))
    return nil, err
    if err then
      log('E', logTag, 'Error reading from socket: ' .. tostring(err))
      return nil, err
    if err then
      log('E', logTag, 'Error reading from socket: ' .. tostring(err))
      return nil, err
  if err then
    log('E', logTag, 'Error reading from socket: ' .. tostring(err))
    return nil, err
  else
    log('E', logTag, 'Got message without message type: ' .. tostring(message))
    request:sendBNGError('Got message without message type.')
      clients:remove(skt)
      log('E', logTag, 'Error reading from socket: ' .. tostring(skt) .. ' - ' .. tostring(err))
      goto continue
      clients:remove(skt)
      log('E', logTag, 'Error reading from socket: ' .. tostring(skt) .. ' - ' .. tostring(err))
      goto continue
  for k, v in pairs(tab) do
    k = type(k) == 'number' and k or tostring(k)
  if err then
    log('E', logTag, 'Error writing to socket: ' .. tostring(err))
    return
  if err then
    log('E', logTag, 'Error writing to socket: ' .. tostring(err))
    return
  ip, port = server:getsockname()
  log('I', logTag, 'Started listening on ' .. ip .. '/' .. tostring(port) .. '.')
  return server
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamBeautifier.lua
  if state == false then
    log('E', "jsonDecode", "unable to decode JSON: "..tostring(context))
    log('E', "jsonDecode", "JSON decoding error: "..tostring(data))
    log('E', "jsonDecode", "unable to decode JSON: "..tostring(context))
    log('E', "jsonDecode", "JSON decoding error: "..tostring(data))
    return nil
@/lua/common/lpack.lua
local function bufTostring(v)
  bufTmp:put(tostring(v))
end
        if ffi.offsetof(v, 'w') ~= nil then -- quat
          bufTmp:put(tostring(v))
        else
      else
        bufTmp:put(tostring(v))
      end
@/lua/ge/extensions/editor/flowgraph/references.lua
          im.TableSetBgColor(im.TableBgTarget_CellBg, im.GetColorU322(columnBackground), 0)
          im.TextWrapped(tostring(categoryData.category))
          im.TableNextColumn()
          im.TableNextColumn()
          im.TextWrapped(tostring(categoryData.nodeInstancesAmount))
          im.TableNextColumn()
      im.PushStyleColor2(im.Col_Text, matchColor)
      im.Text(tostring(tableSize(self.nodeTable)))
      im.PopStyleColor()
      im.PushStyleColor2(im.Col_Text, matchColor)
      im.Text(tostring(self.nodeStatistics.usedNoteTypeAmount))
      im.PopStyleColor()
      im.PushStyleColor2(im.Col_Text, matchColor)
      im.Text(tostring(self.nodeStatistics.usedNodeInstances))
      im.PopStyleColor()
      im.SameLine()
      if im.Selectable1(tostring(rowCount) .. ". ", columnsBasic.selected[0] == rowCount, im.SelectableFlags_SpanAllColumns) then
        columnsBasic.selected[0] = rowCount
      im.SameLine()
      self:highlightText(tostring(n.nodeName), string.lower(ffi.string(self.searchText)))
      im.TableNextColumn()
      im.TableNextColumn()
      im.Text(tostring(n.nodeData.amount))
      im.TableNextColumn()
      im.TableNextColumn()
      im.Text(tostring(tableSize(n.nodeData.amountForProjects)))
      im.TableNextColumn()
      im.TableNextColumn()
      im.Text(tostring(n.nodeData.category))
      im.TableNextColumn()
        im.SameLine()
        if im.Selectable1(tostring(rowCount) .. ". ", columnsBasic.selected[0] == rowCount, im.SelectableFlags_SpanAllColumns) then
          columnsBasic.selected[0] = rowCount
        im.SameLine()
        im.TextWrapped(tostring(p.projectFile))
        im.TableNextColumn()
        im.TableNextColumn()
        im.Text(tostring(p.amount))
        im.TableNextColumn()
@/lua/vehicle/backwardsCompatibility.lua

    local wheelShaft11 = makeShaft("shaft", "wheelaxle" .. tostring(oldDiff1.wheelName1), "diff1", 1, frictionPart * 2, axleBeamsWheel11[1], oldDiff1.wheelName1)
    local wheelShaft12 = makeShaft("shaft", "wheelaxle" .. tostring(oldDiff1.wheelName2), "diff1", 2, frictionPart * 2, axleBeamsWheel12[1], oldDiff1.wheelName2)
    local wheelShaft11 = makeShaft("shaft", "wheelaxle" .. tostring(oldDiff1.wheelName1), "diff1", 1, frictionPart * 2, axleBeamsWheel11[1], oldDiff1.wheelName1)
    local wheelShaft12 = makeShaft("shaft", "wheelaxle" .. tostring(oldDiff1.wheelName2), "diff1", 2, frictionPart * 2, axleBeamsWheel12[1], oldDiff1.wheelName2)
    local wheelShaft21 = makeShaft("shaft", "wheelaxle" .. tostring(oldDiff2.wheelName1), "diff2", 1, frictionPart * 2, axleBeamsWheel21[1], oldDiff2.wheelName1)
    local wheelShaft12 = makeShaft("shaft", "wheelaxle" .. tostring(oldDiff1.wheelName2), "diff1", 2, frictionPart * 2, axleBeamsWheel12[1], oldDiff1.wheelName2)
    local wheelShaft21 = makeShaft("shaft", "wheelaxle" .. tostring(oldDiff2.wheelName1), "diff2", 1, frictionPart * 2, axleBeamsWheel21[1], oldDiff2.wheelName1)
    local wheelShaft22 = makeShaft("shaft", "wheelaxle" .. tostring(oldDiff2.wheelName2), "diff2", 2, frictionPart * 2, axleBeamsWheel22[1], oldDiff2.wheelName2)
    local wheelShaft21 = makeShaft("shaft", "wheelaxle" .. tostring(oldDiff2.wheelName1), "diff2", 1, frictionPart * 2, axleBeamsWheel21[1], oldDiff2.wheelName1)
    local wheelShaft22 = makeShaft("shaft", "wheelaxle" .. tostring(oldDiff2.wheelName2), "diff2", 2, frictionPart * 2, axleBeamsWheel22[1], oldDiff2.wheelName2)
@/lua/ge/extensions/flowgraph/nodes/gameplay/groundmarkers.lua
    local newTarget = self:hasNewTarget()
    --print("groundmarkers: " .. tostring(newTarget))
    if newTarget then
@/lua/vehicle/extensions/tech/vehicleSearcher.lua
      if not string.find(fullName, "parent") and type(vI) ~= 'string' then
        pProc[pCtr] = { name = tostring(fullName), type = type(vI) }
        pCtr = pCtr + 1
@/lua/ge/extensions/editor/vehicleEditor/api/powerTrainUtils.lua
    im.NextColumn()
  --  imguiUtils.cell("engineLoad", tostring(device.engineLoad))
    imguiUtils.cell("forcedInductionCoef", tostring(device.forcedInductionCoef))
  --  imguiUtils.cell("engineLoad", tostring(device.engineLoad))
    imguiUtils.cell("forcedInductionCoef", tostring(device.forcedInductionCoef))
    imguiUtils.cell("intakeAirDensityCoef", tostring(device.intakeAirDensityCoef))
    imguiUtils.cell("forcedInductionCoef", tostring(device.forcedInductionCoef))
    imguiUtils.cell("intakeAirDensityCoef", tostring(device.intakeAirDensityCoef))
  end
    im.NextColumn()
    --imguiUtils.cell("diffAngle", tostring(device.diffAngle))
    im.Text("outputAV2")
    im.NextColumn()
    imguiUtils.SampleFloatDisplay('outputAV2'..tostring(device.name),device.outputAV2,0.8)
    im.NextColumn()
    im.NextColumn()
    imguiUtils.SampleFloatDisplay("outputTorque2"..tostring(device.name),device.outputTorque2,0.8)
    im.NextColumn()
    im.Separator()
    imguiUtils.cell("primaryOutputAVName", tostring(device.primaryOutputAVName))
    imguiUtils.cell("secondaryOutputAVName", tostring(device.secondaryOutputAVName))
    imguiUtils.cell("primaryOutputAVName", tostring(device.primaryOutputAVName))
    imguiUtils.cell("secondaryOutputAVName", tostring(device.secondaryOutputAVName))
    imguiUtils.cell("primaryOutputTorqueName", tostring(device.primaryOutputTorqueName))
    imguiUtils.cell("secondaryOutputAVName", tostring(device.secondaryOutputAVName))
    imguiUtils.cell("primaryOutputTorqueName", tostring(device.primaryOutputTorqueName))
    imguiUtils.cell("secondaryOutputTorqueName", tostring(device.secondaryOutputTorqueName))
    imguiUtils.cell("primaryOutputTorqueName", tostring(device.primaryOutputTorqueName))
    imguiUtils.cell("secondaryOutputTorqueName", tostring(device.secondaryOutputTorqueName))
  end
    for i=0,#device.gearDamages do
      imguiUtils.cell(tostring(i), tostring(device.gearDamages[i]))
    end
    for i=0,#device.gearDamages do
      imguiUtils.cell(tostring(i), tostring(device.gearDamages[i]))
    end
    im.Separator()
    imguiUtils.cell("clutchAngle", tostring(device.clutchAngle))
    imguiUtils.cell("torqueDiff", tostring(device.torqueDiff))
    imguiUtils.cell("clutchAngle", tostring(device.clutchAngle))
    imguiUtils.cell("torqueDiff", tostring(device.torqueDiff))
    imguiUtils.cell("lockSpring", tostring(device.lockSpring))
    imguiUtils.cell("torqueDiff", tostring(device.torqueDiff))
    imguiUtils.cell("lockSpring", tostring(device.lockSpring))
    imguiUtils.cell("lockDamp", tostring(device.lockDamp))
    imguiUtils.cell("lockSpring", tostring(device.lockSpring))
    imguiUtils.cell("lockDamp", tostring(device.lockDamp))
    imguiUtils.cell("thermalEfficiency", tostring(device.thermalEfficiency))
    imguiUtils.cell("lockDamp", tostring(device.lockDamp))
    imguiUtils.cell("thermalEfficiency", tostring(device.thermalEfficiency))
  end
    im.Separator()
    imguiUtils.cell("lockupClutchAngle", tostring(device.lockupClutchAngle))
    im.Text("torqueDiff")
    im.NextColumn()
    imguiUtils.cell("lockupClutchSpring", tostring(device.lockupClutchSpring))
    imguiUtils.cell("lockupClutchDamp", tostring(device.lockupClutchDamp))
    imguiUtils.cell("lockupClutchSpring", tostring(device.lockupClutchSpring))
    imguiUtils.cell("lockupClutchDamp", tostring(device.lockupClutchDamp))
  end
    im.NextColumn()
    imguiUtils.cell("oneWayTorqueSmoother", tostring(device.oneWayTorqueSmoother))
    imguiUtils.cell("parkLockSpring", tostring(device.parkLockSpring))
    imguiUtils.cell("oneWayTorqueSmoother", tostring(device.oneWayTorqueSmoother))
    imguiUtils.cell("parkLockSpring", tostring(device.parkLockSpring))
  end
    im.Separator()
    imguiUtils.cell("parkLockSpring", tostring(device.parkLockSpring))
    imguiUtils.cell("oneWayTorqueSmoother", tostring(device.oneWayTorqueSmoother))
    imguiUtils.cell("parkLockSpring", tostring(device.parkLockSpring))
    imguiUtils.cell("oneWayTorqueSmoother", tostring(device.oneWayTorqueSmoother))
  end
    im.Separator()
    imguiUtils.cell("torqueDiff", tostring(device.torqueDiff))
    imguiUtils.cell("parkLockSpring", tostring(device.parkLockSpring))
    imguiUtils.cell("torqueDiff", tostring(device.torqueDiff))
    imguiUtils.cell("parkLockSpring", tostring(device.parkLockSpring))
    imguiUtils.cell("clutchAngle1", tostring(device.clutchAngle1))
    imguiUtils.cell("parkLockSpring", tostring(device.parkLockSpring))
    imguiUtils.cell("clutchAngle1", tostring(device.clutchAngle1))
    imguiUtils.cell("clutchAngle2", tostring(device.clutchAngle2))
    imguiUtils.cell("clutchAngle1", tostring(device.clutchAngle1))
    imguiUtils.cell("clutchAngle2", tostring(device.clutchAngle2))
    imguiUtils.cell("lockSpring1", tostring(device.lockSpring1))
    imguiUtils.cell("clutchAngle2", tostring(device.clutchAngle2))
    imguiUtils.cell("lockSpring1", tostring(device.lockSpring1))
    imguiUtils.cell("lockSpring2", tostring(device.lockSpring2))
    imguiUtils.cell("lockSpring1", tostring(device.lockSpring1))
    imguiUtils.cell("lockSpring2", tostring(device.lockSpring2))
    imguiUtils.cell("lockDamp1", tostring(device.lockDamp1))
    imguiUtils.cell("lockSpring2", tostring(device.lockSpring2))
    imguiUtils.cell("lockDamp1", tostring(device.lockDamp1))
    imguiUtils.cell("lockDamp2", tostring(device.lockDamp2))
    imguiUtils.cell("lockDamp1", tostring(device.lockDamp1))
    imguiUtils.cell("lockDamp2", tostring(device.lockDamp2))
    imguiUtils.cell("gearRatio1", tostring(device.gearRatio1))
    imguiUtils.cell("lockDamp2", tostring(device.lockDamp2))
    imguiUtils.cell("gearRatio1", tostring(device.gearRatio1))
    imguiUtils.cell("gearRatio2", tostring(device.gearRatio2))
    imguiUtils.cell("gearRatio1", tostring(device.gearRatio1))
    imguiUtils.cell("gearRatio2", tostring(device.gearRatio2))
  end
  im.SetColumnWidth(1, 1000)
  imguiUtils.cell("inputAV", tostring(device.inputAV))
  imguiUtils.cell("outputAV1", tostring(device.outputAV1))
  imguiUtils.cell("inputAV", tostring(device.inputAV))
  imguiUtils.cell("outputAV1", tostring(device.outputAV1))
  if device.outputAV2 then
  if device.outputAV2 then
    imguiUtils.cell("outputAV2", tostring(device.outputAV2))
  end
  end
  imguiUtils.cell("outputTorque1", tostring(device.outputTorque1))
  if device.outputTorque2 then
  if device.outputTorque2 then
    imguiUtils.cell("outputTorque2", tostring(device.outputTorque2))
  end
  end
  imguiUtils.cell("isBroken", tostring(device.isBroken))
  imguiUtils.cell("mode", tostring(device.mode))
  imguiUtils.cell("isBroken", tostring(device.isBroken))
  imguiUtils.cell("mode", tostring(device.mode))
  imguiUtils.cell("virtualMassAV", tostring(device.virtualMassAV))
  imguiUtils.cell("mode", tostring(device.mode))
  imguiUtils.cell("virtualMassAV", tostring(device.virtualMassAV))
  imguiUtils.cell("isPhysicallyDisconnected", tostring(device.isPhysicallyDisconnected))
  imguiUtils.cell("virtualMassAV", tostring(device.virtualMassAV))
  imguiUtils.cell("isPhysicallyDisconnected", tostring(device.isPhysicallyDisconnected))
  imguiUtils.cell("gearRatio", tostring(device.gearRatio))
  imguiUtils.cell("isPhysicallyDisconnected", tostring(device.isPhysicallyDisconnected))
  imguiUtils.cell("gearRatio", tostring(device.gearRatio))
  imguiUtils.cell("cumulativeGearRatio", tostring(device.cumulativeGearRatio))
  imguiUtils.cell("gearRatio", tostring(device.gearRatio))
  imguiUtils.cell("cumulativeGearRatio", tostring(device.cumulativeGearRatio))
  imguiUtils.cell("cumulativeInertia", tostring(device.cumulativeInertia))
  imguiUtils.cell("cumulativeGearRatio", tostring(device.cumulativeGearRatio))
  imguiUtils.cell("cumulativeInertia", tostring(device.cumulativeInertia))
  im.Columns(1)
@/lua/ge/main.lua
print = function(...)
  log("A", "print", tostring(...))
  -- log('A', "print", debug.traceback()) -- find where print is used
  end
  Lua:log('D', 'luaperf', tostring(event) .. ' = ' .. tostring(s.what) .. '_' .. tostring(s.source) .. ':' .. tostring(s.linedefined) .. ' / memory usage: ' .. tostring(m) .. ' (max: ' .. tostring(maxMemUsage) .. ')')
end
  end
  Lua:log('D', 'luaperf', tostring(event) .. ' = ' .. tostring(s.what) .. '_' .. tostring(s.source) .. ':' .. tostring(s.linedefined) .. ' / memory usage: ' .. tostring(m) .. ' (max: ' .. tostring(maxMemUsage) .. ')')
end
  end
  Lua:log('D', 'luaperf', tostring(event) .. ' = ' .. tostring(s.what) .. '_' .. tostring(s.source) .. ':' .. tostring(s.linedefined) .. ' / memory usage: ' .. tostring(m) .. ' (max: ' .. tostring(maxMemUsage) .. ')')
end
  end
  Lua:log('D', 'luaperf', tostring(event) .. ' = ' .. tostring(s.what) .. '_' .. tostring(s.source) .. ':' .. tostring(s.linedefined) .. ' / memory usage: ' .. tostring(m) .. ' (max: ' .. tostring(maxMemUsage) .. ')')
end
  end
  Lua:log('D', 'luaperf', tostring(event) .. ' = ' .. tostring(s.what) .. '_' .. tostring(s.source) .. ':' .. tostring(s.linedefined) .. ' / memory usage: ' .. tostring(m) .. ' (max: ' .. tostring(maxMemUsage) .. ')')
end
  end
  Lua:log('D', 'luaperf', tostring(event) .. ' = ' .. tostring(s.what) .. '_' .. tostring(s.source) .. ':' .. tostring(s.linedefined) .. ' / memory usage: ' .. tostring(m) .. ' (max: ' .. tostring(maxMemUsage) .. ')')
end
function convertPrefabtoJson(filepath)
  log('I', 'convertPrefabtoJson', 'Converting cs prefab: ' .. tostring(filepath) )
  local dir, filename, ext = path.splitWithoutExt(filepath, ".prefab")
  local dir, filename, ext = path.splitWithoutExt(filepath, ".prefab")
  log('I', 'convertPrefabtoJson', '  spawning prefab as = ' .. tostring(filename) )
  local csPrefab = spawnPrefab(filename, filepath, '0 0 0', '0 0 1 0', '1 1 1')
function validatePrefabJson(filepath)
  log('I', 'validatePrefabJson', 'Validating json prefab: ' .. tostring(filepath) )
  local dir, filename, ext = path.splitWithoutExt(filepath, ".prefab.json")
  local dir, filename, ext = path.splitWithoutExt(filepath, ".prefab.json")
  log('I', 'validatePrefabJson', '  Validating prefab as = ' .. tostring(filename) )
  local prefab = spawnPrefab(filename, filepath, '0 0 0', '0 0 1', '1 1 1')
  else
    log('E','', '      Could not find prefab: '..tostring(filepath))
  end
  for _, fn in pairs(filenames or {}) do
    log('I', 'resaveCSFiles', 'converting ts script: ' .. tostring(fn) )
    -- record known things
        local obj = scenetree.findObject(oName)
        log('I', '', ' adding :  ' .. tostring(oName))
        if obj then
    for _, obj in pairs(newObjects) do
      log('I', '', ' * ' .. tostring(obj:getClassName()) .. ' - ' .. tostring(obj:getName()) )
      persistenceMgr:setDirty(obj, '')
    for _, obj in pairs(newObjects) do
      log('I', '', ' * ' .. tostring(obj:getClassName()) .. ' - ' .. tostring(obj:getName()) )
      persistenceMgr:setDirty(obj, '')
      if not className or (className and className ~= "SimSet" and className ~= "SimGroup") then
        log('I', '', ' *Deleting:  ' .. tostring(className) .. ' - ' .. tostring(obj:getName()) )
        obj:delete()
      if not className or (className and className ~= "SimSet" and className ~= "SimGroup") then
        log('I', '', ' *Deleting:  ' .. tostring(className) .. ' - ' .. tostring(obj:getName()) )
        obj:delete()
      for _, fn in pairs(filenames) do
        log('I', 'resaveCSFiles', 'converting ts script: ' .. tostring(fn) )
        -- record known things
            local obj = scenetree.findObject(oName)
            log('I', '', ' adding :  ' .. tostring(oName))
            if obj then
        for _, obj in pairs(newObjects) do
          log('I', '', ' * ' .. tostring(obj:getClassName()) .. ' - ' .. tostring(obj:getName()) )
          persistenceMgr:setDirty(obj, '')
        for _, obj in pairs(newObjects) do
          log('I', '', ' * ' .. tostring(obj:getClassName()) .. ' - ' .. tostring(obj:getName()) )
          persistenceMgr:setDirty(obj, '')
          if not className or (className and className ~= "SimSet" and className ~= "SimGroup") then
            log('I', '', ' *Deleting:  ' .. tostring(className) .. ' - ' .. tostring(obj:getName()) )
            obj:delete()
          if not className or (className and className ~= "SimSet" and className ~= "SimGroup") then
            log('I', '', ' *Deleting:  ' .. tostring(className) .. ' - ' .. tostring(obj:getName()) )
            obj:delete()
function clientStartMission(levelPath)
  log("D", "clientStartMission", "starting levelPath: " .. tostring(levelPath))
  extensions.hookNotify('onClientStartMission', levelPath)
  -- core_gamestate.requestGameState()
  -- log("D", "clientEndMission", "ending levelPath: " .. tostring(levelPath))
  be:physicsStopSimulation()
  --local used_memory_bytes, _ = gcinfo()
  --log('D', "update", "Lua memory usage: " .. tostring(used_memory_bytes/1024) .. "kB")
  profilerPushEvent("GE Main Update")
  for _,v in pairs(files) do
    --print("onFileChanged: " .. tostring(v.filename) .. ' : ' .. tostring(v.type))
    extensions.hook('onFileChanged', v.filename, v.type)
  for _,v in pairs(files) do
    --print("onFileChanged: " .. tostring(v.filename) .. ' : ' .. tostring(v.type))
    extensions.hook('onFileChanged', v.filename, v.type)
  local s = be.persistenceLuaData
  -- log('E', 'main', '>>>> persistent data imported: ' .. tostring(s))
  -- deserialize extensions first, so the extensions are loaded before they are trying to get deserialized
  if not ok then
    log('E', 'main', 'Error importing persistent data: ' .. tostring(data))
    writeFile('persistentDataError.txt', s)
  end
  ui_message({txt="vehicle.main.instability", context={vehicle=tostring(jbeamFilename)}}, 10, 'instability', "danger")
end
    local r = quatFromEuler(0, 0, math.rad(math.random(0, 360)))
    local name = "test_v2_"..tostring(i)
    local instance = prefab:spawn(name, pos, QuatF(r.x, r.y, r.z, r.w), scale)
@/lua/ge/extensions/gameplay/crawl/saveSystem.lua

  log('D', logTag, 'Attempting to load crawl data from: ' .. tostring(filename))
  if not filePath or not isValidPath(filePath) then
    log('E', logTag, 'Invalid file path for ' .. (type or 'item') .. ': ' .. tostring(filePath))
    return nil
  else
    log('E', logTag, 'Unknown type: ' .. tostring(type))
    return nil
    -- Mission trails may not be in player trail list, which is expected
    log("D", logTag, "Trail not found in player list (likely mission trail): " .. tostring(trailId))
    return
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/scriptAI/followPath.lua
  if veh then
    veh:queueLuaCommand('ai:scriptStop('..tostring(self.data.handBrakeWhenFinished)..','..tostring(self.data.straightenWheelsWhenFinished)..')')
  end
  if veh then
    veh:queueLuaCommand('ai:scriptStop('..tostring(self.data.handBrakeWhenFinished)..','..tostring(self.data.straightenWheelsWhenFinished)..')')
  end
    end
    be:queueAllObjectLua('obj:queueGameEngineLua("extensions.hook(\\"onVehicleSubmitInfo\\","..tostring(objectId)..","..serialize(ai.scriptState())..",'..self.id..')")')
  end
  builder:Middle()
  im.Text("Complete " .. tostring(self.complete))
  im.Text("Started " .. tostring(self.started))
  im.Text("Complete " .. tostring(self.complete))
  im.Text("Started " .. tostring(self.started))
end
@/lua/ge/extensions/util/worker.lua
  if not FS:fileExists(daePath) then
    log('E', 'util_worker.compileDae', 'filename not existing: ' .. tostring(daePath))
    return false
  if compileCollada(src, dst, dstData, validateData) == 0 then
    log('I', 'util_worker.compileDae', ' compiled: ' .. tostring(src) .. ' > ' .. tostring(dst))
  else
  if compileCollada(src, dst, dstData, validateData) == 0 then
    log('I', 'util_worker.compileDae', ' compiled: ' .. tostring(src) .. ' > ' .. tostring(dst))
  else
  else
    log('E', 'util_worker.compileDae', 'unable to compile file: ' .. tostring(src))
  end
  if not FS:fileExists(w.filename) then
    log('E', 'util_worker.testImage', 'filename not existing: ' .. tostring(w.filename))
    return false
local function onJobDone(job, totalRunning)
  -- log('E', 'util_worker', 'onJobDone : ' .. dumps(job) .. ', # = ' .. tostring(totalRunning))
  if queued and totalRunning == 0 then
local function loadWork()
  --log('I', 'util_worker', 'working: ' .. tostring(jobfile))
  --TorqueScript.eval("$disableTerrainMaterialCollisionWarning=1;$disableCachedColladaNotification=1;")
  if not workItems then
    log('E', 'worker', 'unable to read work items from file: ' .. tostring(jobfile))
  end
  end
  log('I', 'util_worker', tostring(#workItems) .. " items to work off from file " .. tostring(jobfile) .. " ...") -- .. dumps(workItems))
end
  end
  log('I', 'util_worker', tostring(#workItems) .. " items to work off from file " .. tostring(jobfile) .. " ...") -- .. dumps(workItems))
end
@/lua/ge/extensions/flowgraph/groupHelper.lua
  end
  --print('centerPosX = ' .. tostring(centerPosX))
  --print('centerPosY = ' .. tostring(centerPosY))
  --print('centerPosX = ' .. tostring(centerPosX))
  --print('centerPosY = ' .. tostring(centerPosY))
@/lua/common/libs/lustach/src/lustache/renderer.lua
  local str = value == nil and "" or value
  str = tostring(str)
@/lua/ge/extensions/core/replay.lua
  else
    log('E', '', 'Replay file path does not exist: '..tostring(replayFileName))
  end
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veView.lua
local function createViewFromData(id, data)
  local wndName = wndNamePrefix .. tostring(id)

  local sceneViewName = wndNamePrefix .. tostring(idNotInUse)
  im.PushStyleVar2(im.StyleVar_WindowPadding, im.ImVec2(6, 6))
  if im.BeginPopup('viewcontrol' .. tostring(sceneViewName)) then
    local changedOrtho = false
  if im.IsItemClicked(1) then
    im.OpenPopup('viewcontrol' .. tostring(sceneViewName))
  end
@/lua/ge/extensions/core/audio.lua
  local useHeadphones = TorqueScriptLua.getBoolVar('$pref::SFX::enableHeadphonesMode')
  --dump("useHeadphones = "..tostring(useHeadphones))
@/lua/ge/extensions/editor/materialEditor.lua
        if raw ~= "" then
          local key = k .. ":" .. tostring(layer)
          local rel, abs = normalizePathForCheck(currentMaterial, raw)
                if tex.size.x < 16 or tex.size.y < 16 then
                  pushIssue(key, 2, "Texture size is smaller than 16px: " .. tostring(tex.size.x) .. "x" .. tostring(tex.size.y))
                end
                if tex.size.x < 16 or tex.size.y < 16 then
                  pushIssue(key, 2, "Texture size is smaller than 16px: " .. tostring(tex.size.x) .. "x" .. tostring(tex.size.y))
                end
                if not isPow2(tex.size.x) or not isPow2(tex.size.y) then
                  pushIssue(key, 3, "Texture is not a power of 2: " .. tostring(tex.size.x) .. "x" .. tostring(tex.size.y))
                end
                if not isPow2(tex.size.x) or not isPow2(tex.size.y) then
                  pushIssue(key, 3, "Texture is not a power of 2: " .. tostring(tex.size.x) .. "x" .. tostring(tex.size.y))
                end
  layer = layer or o.layer[0]
  local key = property .. ":" .. tostring(layer)
  local list = texIssues.byKey[key]
    end
    im.tooltip(tostring(#items) .. " issue(s)")
local function materialUsageContextMenu(res, count)
  local popupId = "MU_Popup_" .. tostring(res) .. tostring(count)
  if im.BeginPopup(popupId) then
local function materialUsageContextMenu(res, count)
  local popupId = "MU_Popup_" .. tostring(res) .. tostring(count)
  if im.BeginPopup(popupId) then
    local _, base = path.splitWithoutExt(res or '')
    im.Text('['..((base and base ~= '') and base or tostring(res))..']')

    local suffix = "##"..tostring(res)..tostring(count)

    local suffix = "##"..tostring(res)..tostring(count)
      else
        log('E', '', 'Path :'..tostring(p or res)..' does not exist')
      end
      else
        log('E', '', 'Path :'..tostring(p or res)..' does not exist')
      end
    if im.Selectable1("Copy"..suffix) then
      im.SetClipboardText(tostring(res))
      im.CloseCurrentPopup()
    else
      im.TextUnformatted("Material: " .. tostring(data.lastMat))
      im.SameLine()
        idx = idx + 1
        local key = tostring(row.mesh or ("ts_row_"..idx))
        local even = (idx % 2 == 0)
        im.NextColumn()
        im.TextUnformatted(tostring(row.count or 0))
        im.NextColumn()
        fidx = fidx + 1
        local key = tostring(row.mesh or ("forest_row_"..fidx))
        local even = (fidx % 2 == 0)
        im.NextColumn()
        im.TextUnformatted(tostring(row.count or 0))
        im.NextColumn()
      for tagId = 0, 2 do
        local tag = mat:getField("materialTag", tostring(tagId))
        if tag and tag ~= "" then
  editor.history:commitAction(
    "SetMaterialProperty_" .. property .. "_layer" .. tostring(layer),
    {
      local data = ffi.string(payload.Data)
      -- editor.logInfo(logTag .. "Setting property '" .. property .. "' on layer '" .. tostring(layer or o.layer[0]) .. "' to .. '" .. data .. "'")
      setPropertyWithUndo(property, layer or o.layer[0], data)
  if editor.uiInputText(
    "##" .. property .. tostring(layer),
    editor.getTempCharPtr(currentMaterial:getField(property, layer)),
  if additionalGuiFn then
    im.Columns(2, property .. tostring(layer))
    im.SetColumnWidth(0, size.x + v.style.WindowPadding.x)

  im.PushID1(property .. tostring(layer))
  if im.ImageButton(
  if editor.uiColorEdit4(
    "##rgb_" .. (id or property) .. tostring(layer),
    editor.getTempFloatArray4_StringString(currentMaterial:getField(property, layer)),
  if editor.uiSliderInt(
    "##" .. property .. tostring(layer),
    editor.getTempInt_StringString(currentMaterial:getField(property, layer)),
  if editor.uiSliderFloat(
    "##" .. property .. tostring(layer),
    editor.getTempFloat_StringString(currentMaterial:getField(property, layer)),
  if im.Checkbox(
    "##" .. property .. tostring(layer),
    editor.getTempBool_StringString(currentMaterial:getField(property, layer))
  if im.Checkbox(
    "##" .. label .. property .. tostring(layer),
    editor.getTempBool_StringString((band(animFlags, hex) == hex))
  layer = layer or o.layer[0]
  if im.RadioButton1(labelValue .. "##" .. label .. tostring(layer), (currentMaterial:getField(property, layer) == value)) then
    setPropertyWithUndo(property, layer, value)
  if editor.uiInputFloat(
    "##" .. property .. tostring(layer),
    editor.getTempFloat_StringString(currentMaterial:getField(property, layer)),
  if editor.uiInputFloat2(
    "##" .. property .. tostring(layer),
    editor.getTempFloatArray2_StringString(currentMaterial:getField(property, layer)),
  if editor.uiSliderFloat(
    "##" .. property .. labelA .. tostring(layer),
    valueA,
  if editor.uiSliderFloat(
    "##" .. property .. labelB .. tostring(layer),
    valueB,
  im.PushItemWidth(im.GetContentRegionAvailWidth() - 10)
  if im.Combo1("##" .. label .. property .. tostring(layer), editor.getTempInt_StringString(index), cptr) then
    setPropertyWithUndo(property, layer, items[tonumber(editor.getTempInt_StringString()) + 1])
        editor.history:commitAction(
          "SetCubeMapFace_" .. tostring(index),
          {
local function cubemapFaceImageButton(index, tooltip)
  im.PushID1("cubeFace" .. tostring(index))
  if im.ImageButton(
          editor.history:commitAction(
            "SetCubeMapFace_" .. tostring(index),
            {
      im.NextColumn()
      im.TextUnformatted(tostring(currentMaterial.activeLayers) .. ' of ' .. tostring(maxLayers))
      im.SameLine()
      im.NextColumn()
      im.TextUnformatted(tostring(currentMaterial.activeLayers) .. ' of ' .. tostring(maxLayers))
      im.SameLine()
      if disabled then im.EndDisabled() end
      im.tooltip(currentMaterial.activeLayers >= maxLayers and "You can't have more than " .. tostring(maxLayers) .. " layers" or "Add layer")
      im.SameLine()

  if im.CollapsingHeader1("Animation Properties" .. (layer and "##" .. tostring(layer) or "")) then
    -- Rotation Animation
    local lyr = i - 1
    if im.CollapsingHeader1("Layer " .. tostring(i), i == 1 and im.TreeNodeFlags_DefaultOpen or nil) then
      im.Indent()
      if lyr > 0 then
        if im.Button("Move Up##layer"..tostring(lyr)) then
          swapLayersWithUndo(lyr - 1, lyr)
        if lyr > 0 then im.SameLine() end
        if im.Button("Move Down##layer"..tostring(lyr)) then
          swapLayersWithUndo(lyr, lyr + 1)

      if im.CollapsingHeader1("Basic Properties##" .. tostring(lyr), im.TreeNodeFlags_DefaultOpen) then
        -- Color Map

      if im.CollapsingHeader1("Advanced Properties##" .. tostring(lyr)) then
        -- BaseColor Palette
@/lua/ge/extensions/editor/dynamicDecals/brushes.lua
    im.NextColumn()
    im.TextUnformatted(tostring(brush.alphaMaskIntensity))
    im.NextColumn()
    im.NextColumn()
    im.TextUnformatted(tostring(brush.colorPaletteMapId))
    im.NextColumn()
      else
        im.ColorEdit4("##inspectorDecalColor" .. tostring(k), editor.getTempFloatArray4_TableTable(brush.color))
      end
      if checkFilter_brush(brush.name) then
        im.PushID1("Brush_" .. tostring(k))
        if im.ImageButton("##TabGuiButton", editor.getTempTextureObj(brush.decalColorTexturePath).texId, im.ImVec2(thumbnailSize, thumbnailSize), im.ImVec2Zero, im.ImVec2One, nil, (editor.selection["dynamicDecalBrush"] and editor.selection["dynamicDecalBrush"].id == k) and editor.color.beamng.Value or nil) then
@/lua/vehicle/sounds.lua
      s.clip = createSoundObj(s.filename, s.profile, s.sfxProfile, s.node)
      --log('D', 'sounds.update', 'createSFXSource('..s.sfxProfile..','..s.node..') = '..tostring(s.clip))
      if not s.clip then
          else
            log("E", "sounds.init", "unable to load sound: " .. tostring(soundFile))
          end
@/lua/ge/extensions/core/vehicle/colors.lua
  index = index + 1
  -- log('I','setVehicleColor','setVehicleColor called: index = '..tostring(index)..' colorString = '..tostring(colorString)..' objID = '..tostring(objID))
  local objID = objID or be:getPlayerVehicleID(0)
  index = index + 1
  -- log('I','setVehicleColor','setVehicleColor called: index = '..tostring(index)..' colorString = '..tostring(colorString)..' objID = '..tostring(objID))
  local objID = objID or be:getPlayerVehicleID(0)
  index = index + 1
  -- log('I','setVehicleColor','setVehicleColor called: index = '..tostring(index)..' colorString = '..tostring(colorString)..' objID = '..tostring(objID))
  local objID = objID or be:getPlayerVehicleID(0)
@/lua/ge/extensions/career/modules/branches/leagues.lua
  if dirty > 0  then
    log("W","","Some ("..tostring(dirty)..") missions were not set up properly for leagues.")
    for mId, count in pairs(dirtyFilesById) do
@/lua/ge/extensions/career/modules/milestones/milestones.lua
    else
      return tostring(a.entryId) > tostring(b.entryId)
    end
    else
      return tostring(a.entryId) > tostring(b.entryId)
    end
@/lua/vehicle/ve_utils.lua
      for rk, rv in pairs(rowValue) do
        --log('D', "jbeam.processTableWithSchema", "### "..header[rk].."//"..tostring(newRow[header[rk]]))
        if header[rk] ~= nil then
  else
    return tostring(d)
  end
    f:write("\n" .. indent .. "/*" .. string.rep("*", 50) .. "\n")
    f:write(indent .. " * part " .. tostring(data["partPath"]) .. "\n")
    f:write(indent .. " *" .. string.rep("*", 49) .. "*/\n")
@/lua/ge/extensions/editor/api/gui.lua

    editor.logWarn("Editor windows state file '" .. tostring(finalFilename) .. "' format version mismatch. Expected: " .. WindowsStateFileFormatVersion .. " File: " .. tostring(wstate.version) .. ", will upgrade.")
    wstate = jsonReadFile(defaultWindowsStateFileName)

    editor.logWarn("Editor windows state file '" .. tostring(finalFilename) .. "' format version mismatch. Expected: " .. WindowsStateFileFormatVersion .. " File: " .. tostring(wstate.version) .. ", will upgrade.")
    wstate = jsonReadFile(defaultWindowsStateFileName)
@/lua/common/extensions/networking/editorToolchain.lua
    if ip and port then
      return tostring(ip) .. ':' .. tostring(port)
    end
    if ip and port then
      return tostring(ip) .. ':' .. tostring(port)
    end
    -- ASIO
    return tostring(connection:get_remote_endpoint())
  end
    selectedNodes = nil
    print('Connection closed: ' .. tostring(connection))
    return
        if not nodeFound then
          log('W', 'node to highlight not found / not spawned? ' .. tostring(nodeName))
        end
  else
    server:send(connection, {cmd = "error", message = "unknown command: '" .. tostring(data.cmd) .. "'"}, data)
  end
        for _, node in pairs(vData.vdata.nodes) do
          local name = node.name or tostring(node.cid)
          local pos = veh:getNodePosition(node.cid)
@/lua/ge/extensions/gameplay/crawl/crawlFlowgraphBridge.lua
  if not trail then
    log('E', logTag, 'Failed to load trail: ' .. tostring(trailId))
    return nil
@/lua/ge/extensions/core/vehicle/manager.lua
  if path then
    log('D', 'vehicleLoader', 'Materials changed in vehicle path, invalidating cache: ' .. tostring(path))
    materialsCache[path] = nil
  end
  log('D', 'loader', "GE load time: " .. tostring(timer:stopAndReset() / 1000) .. ' s')
@/lua/common/utils/simpleProfiler/report.lua
  if not templateStr then
    log('E','simpleProfilerReport',"Failed to read template file: "..tostring(templateFile))
    return
@/lua/ge/extensions/editor/bulkRename.lua
      if width == "" then
        return tostring(counter)
      else
    imgui.Separator()
    imgui.Text("Found: " .. tostring(foundCount))
    imgui.Separator()
        if collisionCount ~= 0 then
          collisionCountStr = " (" .. tostring(collisionCount) .. ")"
        end
            imgui.TableSetColumnIndex(2)
            imgui.Text(tostring(id))
            imgui.TableSetColumnIndex(3)
            if entry.collidedWithId ~= 0 then
              imgui.TextColored(imgui.ImVec4(255, 0, 0, 255), tostring(entry.collidedWithId))
            end
@/lua/vehicle/controller/tech/vehicleSystemsCoupling.lua
  for i=1,length,1 do
    out[i] = tostring(i)
  end
@/lua/common/libs/lua-luaepnf/epnf.lua
        write( prefix, "  id = ", node.id,
               ",  pos = ", tostring( node.pos ), "\n" )
      end
        if k ~= "id" and k ~= "pos" then
          write( prefix, "  ", tostring( k ), " = " )
          dump_ast( v, prefix.."  " )
  else
    write( tostring( node ), "\n" )
  end
@/lua/common/extensions.lua
local function luaPathToExtName(filepath)
  -- log('I', logTag, 'luaPathToExtName called '..tostring(filepath))
  if not filepath then
  local res = extName:gsub('__', '#'):gsub('_', '/'):gsub('#', '_')
  -- log('I', logTag, 'extNameToLuaPath >> ' .. tostring(extName) .. ' => ' .. tostring(res))
  return res
  local res = extName:gsub('__', '#'):gsub('_', '/'):gsub('#', '_')
  -- log('I', logTag, 'extNameToLuaPath >> ' .. tostring(extName) .. ' => ' .. tostring(res))
  return res
local function isAvailable(extPath)
  -- log('I', logTag, 'isAvailable called: '..tostring(extPath))
  if package.loaded[extPath] then
    if state == false then
      log('E', "", "Unable to load extension '"..tostring(extPath).."':\n"..loader)
    else
  repeat
    -- log('I', logTag, 'resolving dependencies loop: '..tostring(toResolveModulesSize))
    local preToResolveModulesSize = toResolveModulesSize
      for k, v in pairs(failedModules) do
        log('W', logTag, '    ' .. tostring(k) .. ' dependencies not resolved: '..dumps(v))
      end
    if m == nil then
      --log('I', logTag, 'unable to unload module ' .. tostring(extName) .. ': not loaded')
      goto continue
        if not m.__originalExtPath__ and not package.loaded[m.__originalExtPath__] then
          log('E', logTag, 'unloading '..tostring(extName)..' failed. Trying to clear package with invalid path: ' .. tostring(path))
        else
        if not m.__originalExtPath__ and not package.loaded[m.__originalExtPath__] then
          log('E', logTag, 'unloading '..tostring(extName)..' failed. Trying to clear package with invalid path: ' .. tostring(path))
        else
  if not found then
    log("W", logTag, "Had to manually add the extension name to the list to unload. Auto resolution design did not work - "..tostring(extName))
    table.insert(extrasToUnloadModuleName, extName)
  if type(m) ~= "table" and type(m) ~= "function" then
    log('I', logTag, "Lua extension invalid: " .. extPath .. '. Does it return M? It returned this: ' .. tostring(m))
    trackOnRefresh[m] = nil
  end
  -- log('I', logTag, 'extensionLoadInternal: '.. tostring(extName).. ' from '..tostring(extPath))
  local m = luaMods[extName] or resolvedNormalizedNameToModule[string.lower(extName)]
  end
  -- log('I', logTag, 'extensionLoadInternal: '.. tostring(extName).. ' from '..tostring(extPath))
  local m = luaMods[extName] or resolvedNormalizedNameToModule[string.lower(extName)]
  if m ~= nil then
    --log('D', logTag, 'extension already loaded: '..tostring(extName))
    return m
  if luaMods[extName] == nil then
    log('E', logTag, 'Unable to refresh extension. Not loaded: '..tostring(extName))
    return false
    local k = v.__extensionName__
    --print("k="..tostring(k) .. " = " .. tostring(v))
    if (filter == nil or k == filter) and type(v) == 'table' and (v['onDeserialized'] ~= nil or v['onDeserialize'] ~= nil) and data[k] ~= nil then
    local k = v.__extensionName__
    --print("k="..tostring(k) .. " = " .. tostring(v))
    if (filter == nil or k == filter) and type(v) == 'table' and (v['onDeserialized'] ~= nil or v['onDeserialize'] ~= nil) and data[k] ~= nil then
  if identifierPrefix == nil then identifierPrefix = '' end
  local extName = identifierPrefix .. '_virtual_' .. tostring(getUniqueVirtualExtensionNumber())
  local data = {
  if key == nil then return nil end
  --print('__index called: ' .. tostring(tbl) .. ', ' .. tostring(key))
  if key == nil then return nil end
  --print('__index called: ' .. tostring(tbl) .. ', ' .. tostring(key))
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veFlexbodyDebug.lua

        debugDrawer:drawTextAdvanced(vertPos, tostring(i) .. " " .. coords, textColor, true, false, textBackgroundColor)
      end

    debugDrawer:drawTextAdvanced(nodePos, tostring(node.name or node.cid), textColor, true, false, textBackgroundColor)
    debugDrawer:drawSphere(nodePos, nodeRenderRadius, nodeSelectedColor)

            debugDrawer:drawTextAdvanced(nodePos, nodeName .. ": " .. tostring(node.name or node.cid), textColor, true, false, textBackgroundColor)
          end
        local node = vEditor.vdata.nodes[nodeID]
        local nodeName = tostring(node.name or nodeID)
      for i = 0, vertCount - 1 do
        local vertName = tostring(i)

          if im.TreeNodeEx1(flexmesh.mesh .. "##" .. tostring(k)) then
            for _, vertData in ipairs(verticesData) do

            if im.Button(flexmesh.mesh .. "##" .. tostring(k)) then
              selectFlexbody(flexID, 0.5)
@/lua/ge/extensions/flowgraph/nodes/scene/particleEmitter.lua
    }
    local nm = "_" .. tostring(os.time()) .. "_" .. self.id
    self.object.obj = self:createObject("particles_"..nm)
@/lua/ge/extensions/editor/flowgraph/properties.lua
  else
    im.TextUnformatted('(' .. tostring(type) .. ')')
  end
      else
        im.Text(tostring(k))
      end
  self._editCustomProperties = {}
  self._editCustomProperties.name = im.ArrayChar(256, tostring(item.customName or item.name or ''))
  --self._editCustomProperties.icon = im.ArrayChar(256, tostring(item.customIcon or item.icon or ''))
  self._editCustomProperties.name = im.ArrayChar(256, tostring(item.customName or item.name or ''))
  --self._editCustomProperties.icon = im.ArrayChar(256, tostring(item.customIcon or item.icon or ''))
  local imVal = im.ArrayFloat(4)
      im.SameLine()
      im.TextUnformatted('[' .. tostring(item.id) .. ']: ')
    end
      im.SameLine()
      im.TextUnformatted('(' .. tostring(item.type or '') .. ')')
    end
        else
          local textinput = im.ArrayChar(256, tostring(pin.name or ''))
          if im.InputText('##Name' .. pin.id, textinput, 256, im.InputTextFlags_EnterReturnsTrue) then
            else
              textinput = im.ArrayChar(256, tostring(pin.name or ''))
            end
        if firstLink or pin.type == 'flow' then
          im.TextUnformatted(tostring(item.pinInLocal[pin.name]._value))
        else
        else
          local textinput = im.ArrayChar(256, tostring(pin.name or ''))
          if im.InputText('##Name' .. pin.id, textinput, 256, im.InputTextFlags_EnterReturnsTrue) then
            else
              textinput = im.ArrayChar(256, tostring(pin.name or ''))
            end
        im.NextColumn()
        im.TextUnformatted(tostring(pin._value))
        if firstLink or pin.type == 'flow' then
          im.TextUnformatted(tostring(item.pinInLocal[pin.name]._value))
        else
        im.NextColumn()
        im.TextUnformatted(tostring(pin._value))
        im.NextColumn()
      end
      self:_drawDataTable(tostring("self_id"), item._cdata, item.data, '', cb)
      im.TreePop()
  for i,k in pairs(self.mgr.macroTags) do
    local textinput = im.ArrayChar(256, tostring(k or ''))
    im.PushItemWidth(100)
  im.PushItemWidth(im.GetContentRegionAvailWidth())
  local textinput = im.ArrayChar(256, tostring(graph.name or ''))
  local editEnded = im.BoolPtr(false)
  im.NextColumn()
  local textinput = im.ArrayChar(512, tostring(graph.description or ''))
  local editEnded = im.BoolPtr(false)
@/lua/ge/extensions/flowgraph/nodes/types/quat.lua
  builder:Middle()
  im.Text(tostring(quat(self.pinIn.x.value or 0, self.pinIn.y.value or 0, self.pinIn.z.value or 0, self.pinIn.w.value or 0)))
end
@/lua/ge/extensions/gameplay/rally/recceSettings.lua
  if not self.fname  then
    log('W', logTag, 'load: recce settings fname is nil: '..tostring(self.fname))
    return false
  if not FS:fileExists(self.fname) then
    log('W', logTag, 'load: recce settings fname doesnt exist: '..tostring(self.fname))
    return false
  if not json then
    log('E', logTag, 'load: couldnt find recce settings file: '..tostring(self.fname))
    return false
  self:onDeserialized(json)
  -- log('I', logTag, 'loaded recce settings from '..tostring(self.fname))
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veJBeamPicker.lua
local function getNodeDisplayText(node)
  local dispText = node.name or tostring(node.cid)
  if node.tag then
  if node.tag then
    dispText = dispText .. ' / ' .. tostring(node.tag)
  end
  local node2 = vEditor.vdata.nodes[beam.id2]
  local node1Name = node1.name or tostring(node1.cid)
  local node2Name = node2.name or tostring(node2.cid)
  local node1Name = node1.name or tostring(node1.cid)
  local node2Name = node2.name or tostring(node2.cid)

  local dispText = node1Name .. " - " .. node2Name .. ' (' .. (beam.name and (beam.name..' '..tostring(beam.cid)) or tostring(beam.cid)) .. ')'
  if beam.tag then

  local dispText = node1Name .. " - " .. node2Name .. ' (' .. (beam.name and (beam.name..' '..tostring(beam.cid)) or tostring(beam.cid)) .. ')'
  if beam.tag then
  if beam.tag then
    dispText = dispText .. ' / ' .. tostring(beam.tag)
  end
@/lua/ge/extensions/gameplay/rally/tools/rallyToolbox.lua

  im.Text("self:getDebugLogging()=" .. tostring(self:getDebugLogging()))
  --   local modeName = RallyEnums.drivelineModeNames[rm:getDrivelineMode()]
  --   im.Text("rallyManager.drivelineMode=" .. tostring(modeName))
  -- end
  if shouldBeDisabled then im.BeginDisabled() end
  im.Text("Race Debug (status: "..tostring(raceStatus).." | "..tostring(statusMsg)..")")
  boolPtr = im.BoolPtr(self.debug.drawRaceCurrentSeg)
  if shouldBeDisabled then im.BeginDisabled() end
  im.Text("Race Debug (status: "..tostring(raceStatus).." | "..tostring(statusMsg)..")")
  boolPtr = im.BoolPtr(self.debug.drawRaceCurrentSeg)
@/lua/ge/client/lighting/advanced/lightViz.lua
local function toggleLightVisualizer(objName, enable, tsVariable)
  -- log('I','lightViz', 'toggleLightVisualizer called: name = '..tostring(objName)..' enable = '..tostring(enable)..'  var = '..tostring(tsVariable))
  local vizualiser = scenetree.findObject(objName)
local function toggleLightVisualizer(objName, enable, tsVariable)
  -- log('I','lightViz', 'toggleLightVisualizer called: name = '..tostring(objName)..' enable = '..tostring(enable)..'  var = '..tostring(tsVariable))
  local vizualiser = scenetree.findObject(objName)
local function toggleLightVisualizer(objName, enable, tsVariable)
  -- log('I','lightViz', 'toggleLightVisualizer called: name = '..tostring(objName)..' enable = '..tostring(enable)..'  var = '..tostring(tsVariable))
  local vizualiser = scenetree.findObject(objName)
  if not vizualiser then
    log('E','lightViz', 'Could not find vizualiser object - '..tostring(objName))
    return
  local isEnabled = vizualiser:isEnabled()
  -- log('I','lightViz', objName..'.enabled = '..tostring(isEnabled))
  if enable == nil or enable == "" then
@/lua/ge/extensions/ui/gameplayAppContainers.lua
    if verboseLogging then
      log('W', logTag, 'Unknown flash message source: ' .. tostring(data.source))
    else
    else
      log('D', logTag, 'Unknown flash message source: ' .. tostring(data.source))
    end
          if currentMessage.data and currentMessage.data[1] then
            im.Text("Text: " .. tostring(currentMessage.data[1][1]))
          end
@/lua/vehicle/extensions/tech/impactgen/damageEvaluation.lua
    if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then
      -- log('I', 'damageEvaluation', 'Node prop: ' .. tostring(k) .. ' of type: ' .. type(v))
      nodeProperties[k] = v
    if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then
      -- log('I', 'damageEvaluation', 'Beam prop: ' .. tostring(k) .. ' of type: ' .. type(v))
      beamProperties[k] = v
@/lua/vehicle/extensions/tech/techCore.lua

  local cmd = 'extensions.hook("onVehicleInfoReady", ' .. tostring(obj:getID()) .. ', ' .. serialize(info) .. ')'
  obj:queueGameEngineLua(cmd)
  end
  local cmd = 'extensions.hook("onVehicleConnectionReady", ' .. tostring(obj:getID()) .. ', ' .. tostring(port) .. ')'
  obj:queueGameEngineLua(cmd)
  end
  local cmd = 'extensions.hook("onVehicleConnectionReady", ' .. tostring(obj:getID()) .. ', ' .. tostring(port) .. ')'
  obj:queueGameEngineLua(cmd)
        local ip, clientPort = newClients[i]:getpeername()
        log('I', logTag, 'Accepted new vehicle client: ' .. tostring(ip) .. '/' .. tostring(clientPort))
      end
        local ip, clientPort = newClients[i]:getpeername()
        log('I', logTag, 'Accepted new vehicle client: ' .. tostring(ip) .. '/' .. tostring(clientPort))
      end
    else
      request:sendResponse({type ='ExecutedLuaChunkVE', resp = tostring(err)})
    end
  else
    request:sendBNGValueError('Unknown IMU: ' .. tostring(request['name']))
  end
  else
    request:sendBNGValueError('Node ' .. tostring(nodes) .. ' does not exist.')
  end
@/lua/ge/extensions/flowgraph/nodes/math/math.lua
  if error then
    self.mgr:logEvent("Math Expression Error " .. tostring(self.id), "E", 'Error in math' .. tostring(error), { type = "node", node = self }
      )
  if error then
    self.mgr:logEvent("Math Expression Error " .. tostring(self.id), "E", 'Error in math' .. tostring(error), { type = "node", node = self }
      )
@/lua/ge/extensions/core/settings/graphicsQualityGroup.lua
      local currentValue = TorqueScriptLua.getVar(key)
      changeDetected = changeDetected or tostring(currentValue) ~= tostring(value)
      TorqueScriptLua.setVar(key, value)
      local currentValue = TorqueScriptLua.getVar(key)
      changeDetected = changeDetected or tostring(currentValue) ~= tostring(value)
      TorqueScriptLua.setVar(key, value)
@/lua/ge/extensions/core/repository.lua
  log('E', 'modmanager.'..fn, 'Server Error')
  log('E', 'modmanager.'..fn, 'url = '..tostring(r.uri))
  log('E', 'modmanager.'..fn, 'responseBuf = '..tostring(r.responseBuffer))
  log('E', 'modmanager.'..fn, 'url = '..tostring(r.uri))
  log('E', 'modmanager.'..fn, 'responseBuf = '..tostring(r.responseBuffer))
end
local function deleteUpdateQueue(data)
  log('D', 'repo.deleteUpdateQueue', 'delete ' .. tostring(data.filename) ..'   URI=' .. tostring(data.filename))
  for k,v in pairs(updateQueue) do
local function deleteUpdateQueue(data)
  log('D', 'repo.deleteUpdateQueue', 'delete ' .. tostring(data.filename) ..'   URI=' .. tostring(data.filename))
  for k,v in pairs(updateQueue) do
      uiUpdateQueue()
      log('D', 'repo.deleteUpdateQueue', 'deleted ' .. tostring(k))
      return
  local downloading = 0
  -- log('D', 'repo.updateDownloadQueue', "in queue "..tostring(#updateQueue))
  for k,v in pairs(updateQueue) do
    -- log('D', 'repo.updateDownloadQueue',v.filename.."  update="..tostring(v.update) .."   state="..tostring(v.state) )
    if v.state == "downloading" then
  for k,v in pairs(updateQueue) do
    -- log('D', 'repo.updateDownloadQueue',v.filename.."  update="..tostring(v.update) .."   state="..tostring(v.state) )
    if v.state == "downloading" then
local function changeStateUpdateQueue(fname,nstate)
  --log('I', 'repo.changeStatusUpdateQueue', ' ' .. tostring(fname))
  for k,v in pairs(updateQueue) do
      guihooks.trigger('RepoModChangeStatus', v)
      --log('I', 'repo.changeStatusUpdateQueue', tostring(k) ..' '  .. nstate)
      return
  end
  log('D', 'repository', 'installMod: ' .. tostring(uri) .. ' / ' .. tostring(targetFilename))
  end
  log('D', 'repository', 'installMod: ' .. tostring(uri) .. ' / ' .. tostring(targetFilename))
    if r.responseCode ~= 200 then
      log('E', 'repo.downloadFinishedCallback', 'unable to download file: ' .. tostring(targetFilename) .. ' / reply: ' .. dumps(r))
      guihooks.trigger("toastrMsg", {type="error", title="Repo Error", msg="Could not download the file (Check console for details)"})
    end
    --print("EXISTS: " .. tostring(FS:fileExists(r.outfile)))
    if not FS:fileExists(r.outfile) then
    if not FS:fileExists(r.outfile) then
      log('E', 'repo.downloadFinishedCallback', 'unable to download file: ' .. tostring(uri) .. ' / File missing: ' .. tostring(r.outfile) .. ' / reply: ' .. dumps(r))
      guihooks.trigger("toastrMsg", {type="error", title="Repo Error", msg="Could not download the file, File missing"})
    if not FS:fileExists(r.outfile) then
      log('E', 'repo.downloadFinishedCallback', 'unable to download file: ' .. tostring(uri) .. ' / File missing: ' .. tostring(r.outfile) .. ' / reply: ' .. dumps(r))
      guihooks.trigger("toastrMsg", {type="error", title="Repo Error", msg="Could not download the file, File missing"})
    else
      log('D', 'repo.downloadFinishedCallback', 'file successfully downloaded: ' .. tostring(uri) .. ' > ' .. tostring(r.outfile))
    end
    else
      log('D', 'repo.downloadFinishedCallback', 'file successfully downloaded: ' .. tostring(uri) .. ' > ' .. tostring(r.outfile))
    end
    if prevInfo ~= nil and prevInfo.dirname == "mods/" and prevInfo.fullpath ~= r.outfile then
      log('D', 'repo.downloadFinishedCallback', 'delete old file: ' .. modname .. ' ' .. tostring(prevInfo.fullpath))
      core_modmanager.deleteMod(modname)
local function requestModOffline(mod_id)
  log('D', 'repo.requestModOffline', "id="..tostring(mod_id))
  local data = {}
      if data.data.message:find("X4YRUwRrR9Y.jpg") then
        log('E', 'repo.requestModOffline', "message of modinfo "..tostring(mod_id).." is incorect and have been discarded")
        data.data.message = "Offline Data. [br] Description is incorect."
    -- user opted out, ignore this request
    log('D', 'repo.modSubscribe', "Subscription '"..tostring(mod_id).."' opt out")
    return
  if not core_modmanager.isReady() or not Engine.Online.isAuthenticated() then
    log('D', 'repo.modSubscribe', "Subscription \'"..tostring(mod_id).."\' when online and modmgr is ready")
    table.insert(subList, mod_id)
  for k,v in pairs(updateQueue) do
    if v.id == mod_id then log('E', 'repo.modSubscribe', "Subscription '"..tostring(mod_id).."' already in update list"); return end
  end
  end
  log('D', 'repo.modSubscribe', "Subscription '"..tostring(mod_id))
  core_online.apiCall('s2/v4/modSubscribe/' .. mod_id, function(request)
      end
      guihooks.trigger('repoError', 'Server Error : '..msg.. " ("..tostring(mod_id)..")")
      log('E', 'repo.modSubscribe', 'Server Error : '..msg.. " ("..tostring(mod_id)..")")
      guihooks.trigger('repoError', 'Server Error : '..msg.. " ("..tostring(mod_id)..")")
      log('E', 'repo.modSubscribe', 'Server Error : '..msg.. " ("..tostring(mod_id)..")")
      return
  -- if not core_modmanager.isReady() or not Engine.Online.isAuthenticated() then
  --   log('E', 'repo.modUnsubscribe', "Unsubscribe '"..tostring(mod_id).."' when online and modmgr is ready")
  --   table.insert(unsubList, mod_id)
  local modName = extensions.core_modmanager.getModNameFromID(mod_id)
  log('D', 'repo.modUnsubscribe', tostring(mod_id).." -> "..tostring(modName))
  for k,v in pairs(updateQueue) do
  local modName = extensions.core_modmanager.getModNameFromID(mod_id)
  log('D', 'repo.modUnsubscribe', tostring(mod_id).." -> "..tostring(modName))
  for k,v in pairs(updateQueue) do
      if v.state == "downloading" then
        log('E', 'repo.modUnsubscribe', "Can't unsubscribe '"..tostring(mod_id).."' because it's downloading")
        return
      table.remove( updateQueue, k )
      log('D', 'repo.modUnsubscribe', tostring(mod_id).." pre-canceled")
    end
        end
        guihooks.trigger('repoError', 'Server Error : '..msg.. " ("..tostring(mod_id)..")")
        log('E', 'repo.modUnsubscribe', 'Server Error : '..msg.. " ("..tostring(mod_id)..")")
        guihooks.trigger('repoError', 'Server Error : '..msg.. " ("..tostring(mod_id)..")")
        log('E', 'repo.modUnsubscribe', 'Server Error : '..msg.. " ("..tostring(mod_id)..")")
        return
  table.insert(updateQueue,data)
  --log('I', 'repo.addUpdateQueue',tostring(#updateQueue) )
  --uiUpdateQueue()
@/lua/ge/extensions/core/groundMarkerArrows.lua
    if proxy.state == "unused" then
      --log('I', 'arrow', 'Found unused arrow in proxies: ' .. tostring(id))
      return scenetree.findObjectById(id)
      }
      --log('I', 'arrow', 'Created arrow and proxy: ' .. tostring(id))
    end
  else
    --log('I', 'arrow', 'Using existing arrow pool: ' .. tostring(group:getId()))
    -- Reset all proxies to unused state
              local id = arrow:getId()
              --log('I', 'arrow', 'Creating new arrow ' .. tostring(id) .. ' at wp ' .. tostring(path[i].wp))
              local id = arrow:getId()
              --log('I', 'arrow', 'Creating new arrow ' .. tostring(id) .. ' at wp ' .. tostring(path[i].wp))
            else
              log('W', 'arrow', 'Failed to get unused arrow for wp ' .. tostring(path[i].wp))
            end
    else
      log('W', 'arrow', 'Arrow object not found for id: ' .. tostring(id))
    end
          im.TableNextColumn()
          im.Text(tostring(id))
          im.TableNextColumn()
          im.TableNextColumn()
          im.Text(tostring(proxy.wp or "none"))
          im.TableNextColumn()
          im.TableNextColumn()
          im.Text(tostring(id))
          im.TableNextColumn()
        im.TableNextColumn()
        im.Text(tostring(wp))
        im.TableNextColumn()
        im.TableNextColumn()
        im.Text(tostring(arrowId))
        im.TableNextColumn()
        im.TableNextColumn()
        im.Text(tostring(i))
        im.TableNextColumn()
        im.TableNextColumn()
        im.Text(tostring(wpLog.wp or "none"))
        im.TableNextColumn()
@/lua/ge/extensions/editor/objectToSplineEditor.lua
      im.SameLine()
      str = tostring(scenetree.findObjectById(objId):getName()).." ["..objId.."]"
    end
      im.SameLine()
      str = tostring(scenetree.findObjectById(guideId):getName()).." ["..guideId.."]"
    end
@/lua/ge/extensions/gameplay/rally/vehicleCapture.lua

  log('I', logTag, 'vehicleCapture writing '..tostring(#self.capturesBuffer)..' captures')
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/scriptAI/pathStored.lua
function C:drawCustomProperties()
  im.Text("Stored Path: " .. tostring(#self.aiPath).. " elements.")
  self:drawDebugPath()
    im.PushItemWidth(im.GetContentRegionAvailWidth())
    if im.BeginCombo("Selector",tostring(self.currentID)) then
      for id, rec in pairs(editor_scriptAIManager.getCurrentRecordings()) do
      for id, rec in pairs(editor_scriptAIManager.getCurrentRecordings()) do
        if im.Selectable1(tostring(id), tostring(id) == self.currentID) then
          self.currentID = id
      for id, rec in pairs(editor_scriptAIManager.getCurrentRecordings()) do
        if im.Selectable1(tostring(id), tostring(id) == self.currentID) then
          self.currentID = id
    if rec then
      im.Text("Path with " .. tostring(#rec.path).. " elements.")
      if im.Button("Load Selected Recording into node.") then
  builder:Middle()
  im.Text(tostring(#self.aiPath) .. " elements")
end
@/lua/ge/extensions/gameplay/rallyLoop.lua
  else
    log('D', logTag, 'rallyLoop handleGOTO: default case, gotoRallyLoop='..tostring(gotoRallyLoop))
    rallyLoopManager:startNextMission()
  local mgr = rallyLoopManager
  log('D', logTag, string.format('rallyLoop onAnyMissionWillChange mgr=%s, state=%s, mission=%s, abandoned=%s', tostring(not not mgr), state, mission and mission.id or 'nil', tostring(abandoned)))
  if mgr then
  local mgr = rallyLoopManager
  log('D', logTag, string.format('rallyLoop onAnyMissionWillChange mgr=%s, state=%s, mission=%s, abandoned=%s', tostring(not not mgr), state, mission and mission.id or 'nil', tostring(abandoned)))
  if mgr then
@/lua/ge/extensions/flowgraph/nodes/ui/imgui/elemental/imCheckbox.lua
  local imVal = im.BoolPtr(self.state)
  if im.Checkbox(tostring(self.pinIn.text.value or "Checkbox")  ..'##'.. tostring(self.id), imVal) then
    self.state = imVal[0]
  local imVal = im.BoolPtr(self.state)
  if im.Checkbox(tostring(self.pinIn.text.value or "Checkbox")  ..'##'.. tostring(self.id), imVal) then
    self.state = imVal[0]
@/lua/ge/extensions/scenario/timeLimit.lua

  local errMsg = instance.value.msg or {txt = "extensions.scenario.timeLimit.failedGoal", context = {maxTime = tostring(instance.value.maxTime)}}
  local result = { failed = errMsg }
          if countdown > 0 and instance.wait > countdown then
            helper.flashUiMessage({txt = "extensions.scenario.timeLimit.checkTime.countdown", context = {countdown = tostring(countdown)}}, 0.5, true)
            instance.wait = countdown
      if type(instance.value.maxTime) ~="number" and type(instance.value.waitTime) ~="number" then
        log('E', 'In '..tostring(scenario.name), ' maxTime or waitTime have a wrong type it should be a number')
        goto continue
      if instance.value.countdown and type(instance.value.countdown)~="number" then
        log('E', 'In '..tostring(scenario.name), ' countdown has a wrong type it should be a number')
        goto continue
@/lua/ge/extensions/flowgraph/nodes/util/loadLevel.lua
function C:onLoadingScreenFadeout(missionFile)
  log('E', logTag, 'onLoadingScreenFadeout: ' .. tostring(missionFile))
  dumpz(self, 2)
    local dirM  = path.split(loadedMissionFile)
    --log('I', logTag, "missionDir: "..tostring(dirM))
          -- yes, change level, but disable the player autospawning
          log('D', logTag, 'Loading level from Flowgraph: ' .. tostring(levelPath))
          spawn.preventPlayerSpawning = self.data.preventPlayerSpawning
@/lua/ge/extensions/gameplay/markerInteraction.lua
        -- debug drawing for testing
        --debugDrawer:drawTextAdvanced(marker.pos, String(tostring(cluster.id)), ColorF(1,1,1,1), true, false, ColorI(0,0,0,192))
        --debugDrawer:drawSphere(cluster.pos, cluster.radius, ColorF(0.91,0.05,0.48,0.2))
@/lua/common/guihooks.lua
local function triggerRawJS(hookName, rawJs)
  queueHookJS(hookName, concatWorkBuffer('[', tostring(rawJs), ']'))
end
@/lua/common/utils/interactiveShell.lua
      if result then
        print(tostring(result))
      end
@/lua/ge/extensions/core/remoteController.lua
  while true do
    --log('D', logTag, "getting data from ".. tostring(listenPort))
    local data, ip, listenPort = udpSocket:receivefrom(128)
    --udpSocket:setpeername(ip, port)
    --log('D', logTag, "got '" .. tostring(data) .. "' from "..tostring(ip) .. ":" .. tostring(listenPort))
    if(data:sub(0, 6) == 'beamng') then -- new device trying to connect
    --udpSocket:setpeername(ip, port)
    --log('D', logTag, "got '" .. tostring(data) .. "' from "..tostring(ip) .. ":" .. tostring(listenPort))
    if(data:sub(0, 6) == 'beamng') then -- new device trying to connect
    --udpSocket:setpeername(ip, port)
    --log('D', logTag, "got '" .. tostring(data) .. "' from "..tostring(ip) .. ":" .. tostring(listenPort))
    if(data:sub(0, 6) == 'beamng') then -- new device trying to connect
      log('D', logTag, "Got discovery package from device " .. deviceName ..  " with code " .. args[3])
      if not (args[3] == tostring(code)) then
        log('D', logTag, "Code doesn't match "..code..", ignoring package.")
@/lua/common/utils.lua
function lpad(s, l, c)
  s = tostring(s)
  return string.rep(c, l - #s)..s
function rpad(s, l, c)
  s = tostring(s)
  return s .. string.rep(c, l - #s)
  elseif vtype == 'boolean' then
    bufTmp:put(tostring(v))
  elseif vtype == 'cdata' and ffi.offsetof(v, 'z') ~= nil then  -- vec3
function jsonEncode(v)
  return tostring(jsonEncodeWorkBuffer(v))
end
  end
  return tostring(bufTmp)
end
      if numberPrecision == nil then
        return tostring(v)
      else
  end
  if vtype == 'boolean' then return tostring(v) end
          local cv = jsonEncodePretty(vv, lvl + 1, numberPrecision)
          if cv ~= nil then table.insert(tmp, stringformat('"%s":%s', escapeString(tostring(kk)), cv)) end
        end
  if state == false then
    log('E', "jsonDecode", "unable to decode JSON: "..tostring(context))
    log('E', "jsonDecode", "JSON decoding error: "..tostring(data))
    log('E', "jsonDecode", "unable to decode JSON: "..tostring(context))
    log('E', "jsonDecode", "JSON decoding error: "..tostring(data))
    return nil
        else
          cBufTmp:put(vtype == 'boolean' and tostring(v) or v)
        end
    else
      cBufTmp:put(vtype == 'boolean' and tostring(v) or v)
    end
  else
    return tostring(a) < tostring(b)
  end
  else
    return tostring(a) < tostring(b)
  end
      else
        log('E', 'serializePackages', 'Error serializing package '..k..': '..tostring(result))
      end
      if not success then
        log('E', 'deserializePackages', 'Error deserializing package '..k..': '..tostring(err))
      end
    local v = d[k]
    table.insert(c, ("%s = %s\r\n"):format(tostring(k), tostring(v)))
  end
    local v = d[k]
    table.insert(c, ("%s = %s\r\n"):format(tostring(k), tostring(v)))
  end
  elseif vtype == "boolean" then
    bufTmp:put(tostring(v))
  elseif vtype == 'nil' then
  elseif vtype == 'cdata' then
    bufTmp:put(tostring(v))
  elseif vtype == 'function' then
function serialize(v)
  return tostring(serializeWorkBuffer(v))
end
--   d = {a = "foo", b = {c = 123, d = "foo", p = vec3(1,2,3)}}
--   print("original data: " .. tostring(d))
--   dump(d)
--   s = serialize(d)
--   print("serialized data: " .. tostring(s))
--   da = deserialize(s)
--   da = deserialize(s)
--   print("restored data: " .. tostring(da))
--   dump(da)
      rawset(_G, key, val)
      log('W', 'globals', debug.traceback('set new global variable: "' .. tostring(key) .. '"  to "'  .. tostring(val) .. '"', 2, 1, false))
    end,
      rawset(_G, key, val)
      log('W', 'globals', debug.traceback('set new global variable: "' .. tostring(key) .. '"  to "'  .. tostring(val) .. '"', 2, 1, false))
    end,
    if type(v) == 'table' then
      local tblPtr = tostring(v)
      if not tableRegister[tblPtr] then
      if not tableRegister[tblPtr] then
        local newPath = path .. '/' .. tostring(k)
        tableRegister[tblPtr] = '>#>' .. newPath
    if type(v) == 'table' then
      local newPath = path .. '/' .. tostring(k)
      tableRegister['>#>' .. newPath] = v
  if text then
    debugDrawer:drawTextAdvanced(pos, String(tostring(text or "")), ColorF(1,1,1,1), true, false, ColorI(0,0,0,192))
  end
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/sessionStart.lua
      missionDir = scheduleEntry and scheduleEntry.missionDir
      log('D', logTag, 'Got mission from rally loop: ' .. tostring(missionId) .. ', dir: ' .. tostring(missionDir))
    end
      missionDir = scheduleEntry and scheduleEntry.missionDir
      log('D', logTag, 'Got mission from rally loop: ' .. tostring(missionId) .. ', dir: ' .. tostring(missionDir))
    end
    end
    log('D', logTag, 'Detected mission: ' .. tostring(missionId) .. ', dir: ' .. tostring(missionDir))
  end
    end
    log('D', logTag, 'Detected mission: ' .. tostring(missionId) .. ', dir: ' .. tostring(missionDir))
  end
@/lua/ge/extensions/gameplay/rally/trafficExclusion.lua
  if not FS:fileExists(racePathFile) then
    log('D', logTag, "Race path file not found: " .. tostring(racePathFile))
    return nil
  else
    log('E', logTag, "Failed to read/parse race path: " .. tostring(racePathFile))
  end
      else
        log('E', logTag, "Mission not found: " .. tostring(missionId))
      end
    else
      log('W', logTag, "Unsupported mission type for traffic exclusion: " .. tostring(mission.missionType))
    end
@/lua/ge/client/parseArgs.lua
  local argumentCount = tonumber(getConsoleVariable("$Game::argc"))
  -- log('I','parse','$Game::argv = '..getConsoleVariable("$Game::argv")..'     argumentCount: '..tostring(argumentCount))
  if argumentCount then
    for i = 0, argumentCount - 1 do
      local arg = getConsoleVariable("$Game::argv".. tostring(i))
      local nextArg = getConsoleVariable("$Game::argv".. tostring(i + 1))
      local arg = getConsoleVariable("$Game::argv".. tostring(i))
      local nextArg = getConsoleVariable("$Game::argv".. tostring(i + 1))
      local hasNextArg = (argumentCount - i) > 1
      local hasNextArg = (argumentCount - i) > 1
      -- log('I','parse',"    $Game::argv".. tostring(i).."= "..tostring(arg))
      local hasNextArg = (argumentCount - i) > 1
      -- log('I','parse',"    $Game::argv".. tostring(i).."= "..tostring(arg))
@/lua/common/utils/filterchain.lua
function Interval:get(dt, ...)
    --print('dt: ' .. tostring(dt) .. '/ ' .. tostring(self.timer) .. ' ### ' .. tostring(self.state) )
    self.timer = self.timer + dt
function Interval:get(dt, ...)
    --print('dt: ' .. tostring(dt) .. '/ ' .. tostring(self.timer) .. ' ### ' .. tostring(self.state) )
    self.timer = self.timer + dt
function Interval:get(dt, ...)
    --print('dt: ' .. tostring(dt) .. '/ ' .. tostring(self.timer) .. ' ### ' .. tostring(self.state) )
    self.timer = self.timer + dt
@/lua/ge/extensions/editor/gen/network.lua
--U.hightOnCurve = function(p, aheight, decal, start)
--  print('>> hightOnCurve:'..tostring(p)..':'..#aheight..':'..decal:getEdgeCount()..':'..start)
            if dbg == true then
        if dbg and pi * pip < 0 then
            print('??___<:'..i..'/'..start..':'..tostring(p)..':'..tostring(ni)..':'..tostring(nip)..':'..p:distanceToLineSegment(ni, nip))
--            adbg[#adbg+1] = {decal:getMiddleEdgePosition(i),ColorF(0,1,1,1), 0.2}
        if dbg and pi * pip < 0 then
            print('??___<:'..i..'/'..start..':'..tostring(p)..':'..tostring(ni)..':'..tostring(nip)..':'..p:distanceToLineSegment(ni, nip))
--            adbg[#adbg+1] = {decal:getMiddleEdgePosition(i),ColorF(0,1,1,1), 0.2}
        if dbg and pi * pip < 0 then
            print('??___<:'..i..'/'..start..':'..tostring(p)..':'..tostring(ni)..':'..tostring(nip)..':'..p:distanceToLineSegment(ni, nip))
--            adbg[#adbg+1] = {decal:getMiddleEdgePosition(i),ColorF(0,1,1,1), 0.2}
        if pi * pip <= 0 and p:distanceToLineSegment(ni, nip) < w then
    --      print('?? hoc:'..i..':'..pi..':'..pip..' ni:'..tostring(ni)..' nip:'..tostring(nip))
            pi = math.abs(pi) --/(p - ni):length()/(nip - ni):length()
        if pi * pip <= 0 and p:distanceToLineSegment(ni, nip) < w then
    --      print('?? hoc:'..i..':'..pi..':'..pip..' ni:'..tostring(ni)..' nip:'..tostring(nip))
            pi = math.abs(pi) --/(p - ni):length()/(nip - ni):length()
                av[(i + 1)*step + 1].z * pi/(pi + pip)
--            print('<< hightOnCurve:'..i..'/'..start..' p:'..tostring(p))
    --        local h = aheight[i]*(1 - pi/(pi + pip)) + aheight[i+1]*pi/(pi + pip)
        end
--    print('?? for_node:'..i..':'..tostring(cp)..' d:'..(p-cp):length())
    end
    groupEdit = scenetree.findObject('e_road')
    lo('??_______________________________________ nw_e_road:'..tostring(groupEdit))
    if groupEdit then
    groupEdit = scenetree.findObject('e_road')
    lo('= NETWORK:'..tostring(groupEdit))
    if groupEdit == nil then
    if groupEdit == nil then
            lo('?? if_SG:'..tostring(scenetree.findObject('SimGroup')))
        groupEdit = scenetree.findObject('SimGroup')
        groupEdit = scenetree.findObject('e_road')
        lo('?? e_road:'..tostring(groupEdit))
        if groupEdit then
local  tb = extensions.editor_terrainEditor.getTerrainBlock()
--lo('??************** for_TB:'..tostring(tb:getObjectBox():getExtents()))
--U.dump(tb:getObjectBox():getExtents(), '??********** for_TB:')
    local a, b = c1.r, c2.r
--    print('>> circleFit:'..stamp..':'..r..' anode:'..#anode..' iter:'..nIter..' d:'..tostring(math.abs(d - (a + b)))..':'..tostring(massCenter))
    vn = vn:normalized()
    local a, b = c1.r, c2.r
--    print('>> circleFit:'..stamp..':'..r..' anode:'..#anode..' iter:'..nIter..' d:'..tostring(math.abs(d - (a + b)))..':'..tostring(massCenter))
    vn = vn:normalized()
    local dmiddle, flip = 0, 1
--    print('?? circleFit_d:'..stamp..':'..tostring(d)..':'..tostring(vn))
    -- get center position
    local dmiddle, flip = 0, 1
--    print('?? circleFit_d:'..stamp..':'..tostring(d)..':'..tostring(vn))
    -- get center position
    local x, y
--    print('?? circleFit.pre_int:'..#anode..':'..d..':'..tostring(c1.pos)..':'..tostring(c2.pos)..':'..(d -(a+b)))
    if math.abs(d - (a + b)) > 0.0001 then
    local x, y
--    print('?? circleFit.pre_int:'..#anode..':'..d..':'..tostring(c1.pos)..':'..tostring(c2.pos)..':'..(d -(a+b)))
    if math.abs(d - (a + b)) > 0.0001 then
        if (vflip - massCenter/#anode):length() > (v - massCenter/#anode):length() then
--            print('?? TO_flip:'..stamp..':'..tostring(massCenter)..':'..#anode..':'..dmiddle)
            y = -y
    local v = U.vturn({x = x, y = y}, ang)
--            print('?? cF2:'..x..':'..y..'::'..tostring(v)..':'..ang)
    local nd = {
        nd.pos = c1.pos + vn*(c1.r + dmiddle) + vec3(v.x, v.y, 0)
--        print('!! sign: x:'..x..' y:'..y..' vn:'..tostring(vn)..' ang:'..ang..':'..tostring(spos)..'>'..tostring(nd.pos)..':'..math.abs((spos - c1.pos):length()/(c1.r + nd.r)))
    end
        nd.pos = c1.pos + vn*(c1.r + dmiddle) + vec3(v.x, v.y, 0)
--        print('!! sign: x:'..x..' y:'..y..' vn:'..tostring(vn)..' ang:'..ang..':'..tostring(spos)..'>'..tostring(nd.pos)..':'..math.abs((spos - c1.pos):length()/(c1.r + nd.r)))
    end
        nd.pos = c1.pos + vn*(c1.r + dmiddle) + vec3(v.x, v.y, 0)
--        print('!! sign: x:'..x..' y:'..y..' vn:'..tostring(vn)..' ang:'..ang..':'..tostring(spos)..'>'..tostring(nd.pos)..':'..math.abs((spos - c1.pos):length()/(c1.r + nd.r)))
    end
        local k = inear
--        print('??******* int_resolve:'..i..':'..j..':'..inear..':'..tostring(nd.pos))
        -- select longer side

--    print('<<------ circleFit:'..stamp..':'..tostring(nd.pos)..':'..tostring(nd.d)) --..tostring(i)..':'..tostring(j)..':'..tostring(#anode)..':'..tostring(counter['1_2']))
    return nd

--    print('<<------ circleFit:'..stamp..':'..tostring(nd.pos)..':'..tostring(nd.d)) --..tostring(i)..':'..tostring(j)..':'..tostring(#anode)..':'..tostring(counter['1_2']))
    return nd

--    print('<<------ circleFit:'..stamp..':'..tostring(nd.pos)..':'..tostring(nd.d)) --..tostring(i)..':'..tostring(j)..':'..tostring(#anode)..':'..tostring(counter['1_2']))
    return nd

--    print('<<------ circleFit:'..stamp..':'..tostring(nd.pos)..':'..tostring(nd.d)) --..tostring(i)..':'..tostring(j)..':'..tostring(#anode)..':'..tostring(counter['1_2']))
    return nd

--    print('<<------ circleFit:'..stamp..':'..tostring(nd.pos)..':'..tostring(nd.d)) --..tostring(i)..':'..tostring(j)..':'..tostring(#anode)..':'..tostring(counter['1_2']))
    return nd

--    print('<<------ circleFit:'..stamp..':'..tostring(nd.pos)..':'..tostring(nd.d)) --..tostring(i)..':'..tostring(j)..':'..tostring(#anode)..':'..tostring(counter['1_2']))
    return nd
    ccenter = pos
        print('>>+++++++++++++++++++++++++ circleSeed:'..nnode..':'..tostring(mode)..':'..#anode..':'..tostring(pos)..' h:'..tostring(h))
    ccenter = pos
        print('>>+++++++++++++++++++++++++ circleSeed:'..nnode..':'..tostring(mode)..':'..#anode..':'..tostring(pos)..' h:'..tostring(h))
    ccenter = pos
        print('>>+++++++++++++++++++++++++ circleSeed:'..nnode..':'..tostring(mode)..':'..#anode..':'..tostring(pos)..' h:'..tostring(h))
        else
--            print('?? from_state:'..i..':'..tostring(state[i]))
            ar[#ar + 1] = state[i].r
    anode[#anode + 1] = { pos = U.vturn(vec3(ar[1] + ar[2], 0, 0), ang), r = ar[2], ang = ang, stamp = '0_1' }
--            print('?? FOR_2:'..tostring(ang)..':'..tostring(anode[#anode].pos)..':'..tostring(anode[#anode].ang))
--    U.dump(anode[#anode], '?? FOR_2:'..tostring(ang))
    anode[#anode + 1] = { pos = U.vturn(vec3(ar[1] + ar[2], 0, 0), ang), r = ar[2], ang = ang, stamp = '0_1' }
--            print('?? FOR_2:'..tostring(ang)..':'..tostring(anode[#anode].pos)..':'..tostring(anode[#anode].ang))
--    U.dump(anode[#anode], '?? FOR_2:'..tostring(ang))
    anode[#anode + 1] = { pos = U.vturn(vec3(ar[1] + ar[2], 0, 0), ang), r = ar[2], ang = ang, stamp = '0_1' }
--            print('?? FOR_2:'..tostring(ang)..':'..tostring(anode[#anode].pos)..':'..tostring(anode[#anode].ang))
--    U.dump(anode[#anode], '?? FOR_2:'..tostring(ang))
--            print('?? FOR_2:'..tostring(ang)..':'..tostring(anode[#anode].pos)..':'..tostring(anode[#anode].ang))
--    U.dump(anode[#anode], '?? FOR_2:'..tostring(ang))
    edges.astamp[#edges.astamp + 1] = U.stamp({1, 2})
            d = state[i].d
--            print('?? res_pair:'..i..":"..tostring(pair))
        else
            if state ~= nil then
--                print('?? RE_pair:'..i..':'..state[i].stamp..':'..tostring(edges.infaces[state[i].stamp]))
            end
        end
--        print('?? pre_fit:'..#anode..':'..tostring(anode[#anode].pos)..':'..anode[#anode].r)
        circleFit(pair, ar[i], d)
    end
        U.dump(anode, '?? anode:'..tostring(massCenter))
    U.dump(edges.astamp)
--            local x, y = U.segmentCross(anode[cp].pos, anode[imi].pos, anode[ic[1]].pos, anode[ic[2]].pos)
--            print('?? CROSS:'..tostring(x)..':'..tostring(y))
            print('?? CROSS:'..cp..':'..imi..' X '..crossed..':'..tostring(xc)..':'..tostring(yc))
--            local x, y = U.segmentCross(anode[cp].pos, anode[imi].pos, anode[ic[1]].pos, anode[ic[2]].pos)
--            print('?? CROSS:'..tostring(x)..':'..tostring(y))
            print('?? CROSS:'..cp..':'..imi..' X '..crossed..':'..tostring(xc)..':'..tostring(yc))
--            print('?? CROSS:'..tostring(x)..':'..tostring(y))
            print('?? CROSS:'..cp..':'..imi..' X '..crossed..':'..tostring(xc)..':'..tostring(yc))
        end
--            print('?? CROSS:'..tostring(x)..':'..tostring(y))
            print('?? CROSS:'..cp..':'..imi..' X '..crossed..':'..tostring(xc)..':'..tostring(yc))
        end
                cp = path[#path]
                print('?? HAS_CROSS:'..n..'/'..(#anode*2)..':'..tostring(cp)..'/'..#afree)
--                        break
    for i = 1,#path do
--        print('?? for_node:'..i..':'..path[i]..'<'..tostring(path[i - 1]))
        local h = 0
        if nc == path[i - 1] and (nb == path[i] or ne == path[i]) then
--            print('??==== obt1: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true
        if nc == path[i - 1] and (nb == path[i] or ne == path[i]) then
--            print('??==== obt1: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true
        if nc == path[i - 1] and (nb == path[i] or ne == path[i]) then
--            print('??==== obt1: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true
        if nc == path[i] and (nb == path[i - 1] or ne == path[i - 1]) then
--            print('??==== obt2: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true
        if nc == path[i] and (nb == path[i - 1] or ne == path[i - 1]) then
--            print('??==== obt2: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true
        if nc == path[i] and (nb == path[i - 1] or ne == path[i - 1]) then
--            print('??==== obt2: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true
        end
--        print('?? for_ang:'..tostring(v:normalized())..':'..aang[#aang][2])
    end
    )
        print('?? path2decal.ID:'..tostring(newRoadID))
--        if true then return end
    for i = 1,#path do
--        print('?? for_node:'..i..':'..path[i]..'<'..tostring(path[i - 1]))
        local h = 0
        if nc == path[i - 1] and (nb == path[i] or ne == path[i]) then
--            print('??==== obt1: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true
        if nc == path[i - 1] and (nb == path[i] or ne == path[i]) then
--            print('??==== obt1: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true
        if nc == path[i - 1] and (nb == path[i] or ne == path[i]) then
--            print('??==== obt1: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true

--            print('??==== obt2: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true

--            print('??==== obt2: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true

--            print('??==== obt2: >'..path[i]..':'..tostring(nb)..'>'..tostring(nc)..'>'..tostring(ne))
            tounfold = true
            local pmiddle = (anode[path[i]].pos + anode[path[i - 1]].pos)/2
--                lo('?? unfolding:'..path[i-1]..'>'..path[i]..':'..tostring(massCenter)..':'..tostring(anode[path[i]].pos))
            local v = anode[path[i]].pos - anode[path[i - 1]].pos
            local pmiddle = (anode[path[i]].pos + anode[path[i - 1]].pos)/2
--                lo('?? unfolding:'..path[i-1]..'>'..path[i]..':'..tostring(massCenter)..':'..tostring(anode[path[i]].pos))
            local v = anode[path[i]].pos - anode[path[i - 1]].pos
    --    local acnode = editor.getNodes(road)
    --        U.dump(dec2path, '?? DEC2PATH:'..tostring(nedge)..':'..#acnode)
        local aseg = {}
                if U.proj2D(n.pos - epos):length() < 0.1 then
    --                lo('?? HIT:'..k..'<'..i..':'..tostring(n.pos)..':'..tostring(nodelist[k].pos))
                    cedge = i + 1
                if U.proj2D(n.pos - epos):length() < 0.1 then
    --                lo('?? HIT:'..k..'<'..i..':'..tostring(n.pos)..':'..tostring(nodelist[k].pos))
                    cedge = i + 1
                        local a,b = (an[k].pos-sc):length(),(an[k+1].pos-sc):length()
    --                        lo('?? for_VVV:'..tostring(an[k+1]))
                        local v = an[k+1].pos - sc
                                local a = (ia/astep - 1/2)*math.pi
            --                        lo('?? for_s:'..tostring(sc)..':'..tostring(v)..':'..tostring(a))
                                local cp = sc + step*U.vturn(v, a)
                                local a = (ia/astep - 1/2)*math.pi
            --                        lo('?? for_s:'..tostring(sc)..':'..tostring(v)..':'..tostring(a))
                                local cp = sc + step*U.vturn(v, a)
                                local a = (ia/astep - 1/2)*math.pi
            --                        lo('?? for_s:'..tostring(sc)..':'..tostring(v)..':'..tostring(a))
                                local cp = sc + step*U.vturn(v, a)
                            local a = (ia/astep - 1/2)*math.pi
        --                        lo('?? for_s:'..tostring(sc)..':'..tostring(v)..':'..tostring(a))
                            local cp = sc + step*U.vturn(v, a)
                            local a = (ia/astep - 1/2)*math.pi
        --                        lo('?? for_s:'..tostring(sc)..':'..tostring(v)..':'..tostring(a))
                            local cp = sc + step*U.vturn(v, a)
                            local a = (ia/astep - 1/2)*math.pi
        --                        lo('?? for_s:'..tostring(sc)..':'..tostring(v)..':'..tostring(a))
                            local cp = sc + step*U.vturn(v, a)
                        end
                            lo('?? for_dir:'..i..':'..tostring(vmi))
        --                    a = 0
        end
--            U.dump(pth, '?? pre_lev:'..tostring(ib)..':'..tostring(ie))
        for o = ib,ie,dir do
        end
--            U.dump(pth, '?? pre_lev:'..tostring(ib)..':'..tostring(ie))
        for o = ib,ie,dir do
    end
    print('?? GROUND:'..iground..'/'..#pth..':'..tostring(pth[iground]))
    toLevels(pth, iground, 1)
        end
--        print('?? for_h: i='..i..' h1:'..h1..' h2:'..h2..' cpin:'..cpin..':'..tostring(road.apin[cpin - 1])..':'..tostring(road.apin[cpin]))
        if road.apin[cpin-1][2] == 1 and road.apin[cpin][2] == 1 then
        end
--        print('?? for_h: i='..i..' h1:'..h1..' h2:'..h2..' cpin:'..cpin..':'..tostring(road.apin[cpin - 1])..':'..tostring(road.apin[cpin]))
        if road.apin[cpin-1][2] == 1 and road.apin[cpin][2] == 1 then
    be:reloadCollision()
        lo('>> decalUpdate:'..tostring(#hmap)..':'..tostring(#apin))
--    local dec = scenetree.findObjectById(id)
    be:reloadCollision()
        lo('>> decalUpdate:'..tostring(#hmap)..':'..tostring(#apin))
--    local dec = scenetree.findObjectById(id)
    local adec = editor.getNodes(dec)
--        print('?? to_del:'..r.id..':'..#adec..':'..tostring(r.meshid)..':'..#r.av..':'..nsec)
        if dbg then
--            print('?? for_UPD:'..o..'/'..#adec..':'..tostring(apin[o]))
        end
        end
--                print('?? np:'..o..':'..tostring(n.pos))
        n.pos.z = hmap[apin[o][1]] + 0.2
local function toDecals()
        print('>>-------------------------------- toDecals:'..#apath..':'..tostring(#jointpath))
    exits = {}
                            hmap[i] = chight
                                lo('?? to_hmap:'..i..':'..tostring(chight))
                        else
                        apin[#apin + 1] = {i}
                            lo('??__ APH:'..i..':'..tostring(hmap[i])..':'..tostring(pedge)) --#apin)
        --                    print('?? e2n:'..i..':'..j..':'..tostring(levels[r.dec2path[j]])..':'..tostring(hLevel))
                        apin[#apin + 1] = {i}
                            lo('??__ APH:'..i..':'..tostring(hmap[i])..':'..tostring(pedge)) --#apin)
        --                    print('?? e2n:'..i..':'..j..':'..tostring(levels[r.dec2path[j]])..':'..tostring(hLevel))
                            lo('??__ APH:'..i..':'..tostring(hmap[i])..':'..tostring(pedge)) --#apin)
        --                    print('?? e2n:'..i..':'..j..':'..tostring(levels[r.dec2path[j]])..':'..tostring(hLevel))
                        cdec = j + 1
                            lo('??__ APH:'..i..':'..tostring(hmap[i])..':'..tostring(pedge)) --#apin)
        --                    print('?? e2n:'..i..':'..j..':'..tostring(levels[r.dec2path[j]])..':'..tostring(hLevel))
                        cdec = j + 1
            apin[#apin + 1] = {nsec - 1}
        --                print('?? FOR_LAST:'..tostring(rd:getMiddleEdgePosition(nsec - 1))..':'..tostring(rd:getMiddleEdgePosition(nsec))..':'..tostring(adec[#adec].pos)..':'..#adec)
            r.hmap = hmap
            apin[#apin + 1] = {nsec - 1}
        --                print('?? FOR_LAST:'..tostring(rd:getMiddleEdgePosition(nsec - 1))..':'..tostring(rd:getMiddleEdgePosition(nsec))..':'..tostring(adec[#adec].pos)..':'..#adec)
            r.hmap = hmap
            apin[#apin + 1] = {nsec - 1}
        --                print('?? FOR_LAST:'..tostring(rd:getMiddleEdgePosition(nsec - 1))..':'..tostring(rd:getMiddleEdgePosition(nsec))..':'..tostring(adec[#adec].pos)..':'..#adec)
            r.hmap = hmap
                    --- update decal
--                    print('?? PRE_UP: nsec='..nsec..' adec='..#adec..':'..tostring(rd)..'::'..#hmap..'::'..tostring(#r.apin))
--                        U.dump(hmap, '?? hmap:')
                    --- update decal
--                    print('?? PRE_UP: nsec='..nsec..' adec='..#adec..':'..tostring(rd)..'::'..#hmap..'::'..tostring(#r.apin))
--                        U.dump(hmap, '?? hmap:')
local function av2hmap(dec, list, dbg)
--            print('>> av2hmap:'..tostring(dbg))
    local hmap, apin = {}, {}
                end
--                print('?? av2hmap:'..ind..':'..tostring(dec:getMiddleEdgePosition(ind))..':'..ei)
            local h = U.hightOnCurve(dec:getMiddleEdgePosition(ind), rdinfo, ei, dbg)
            else
                print('!! av2hmap.NO_H:'..ind..':'..tostring(dbg))
            end
                if dbg then
                    print('?? forOut:'..i..':'..d..':'..tostring(dp))
                end
        for _,dir in pairs {1, -1} do
                    print('?? for_dir:'..dir..':'..s[2]..':'..tostring(decal:getEdgeCount())..':'..tostring(decal:getMiddleEdgePosition(s[2]))) --..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2] + dir))..':'..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2])))
            adir[#adir + 1] =
        for _,dir in pairs {1, -1} do
                    print('?? for_dir:'..dir..':'..s[2]..':'..tostring(decal:getEdgeCount())..':'..tostring(decal:getMiddleEdgePosition(s[2]))) --..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2] + dir))..':'..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2])))
            adir[#adir + 1] =
        for _,dir in pairs {1, -1} do
                    print('?? for_dir:'..dir..':'..s[2]..':'..tostring(decal:getEdgeCount())..':'..tostring(decal:getMiddleEdgePosition(s[2]))) --..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2] + dir))..':'..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2])))
            adir[#adir + 1] =
        for _,dir in pairs {1, -1} do
                    print('?? for_dir:'..dir..':'..s[2]..':'..tostring(decal:getEdgeCount())..':'..tostring(decal:getMiddleEdgePosition(s[2]))) --..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2] + dir))..':'..tostring(roads[s[1]].decal:getMiddleEdgePosition(s[2])))
            adir[#adir + 1] =
        if ctime - stime > 300 then
            lo('?? ani_STEP:'..inanim.n..':'..ctime) --..tostring(math.floor(socket.gettime()*1000)))
    --        inanim = {ain = ani, cb = roadAni}
                end
                    lo('?? network.MC:'..nm..':'..tostring(icirc))
                if string.find(nm, 'road_') == 1 then
                    local rd = rayCast.object
                            print('?? if_dec:'..tostring(rd.decal))
                    if rd.decal ~= nil then
                    lo('?? N.to_SEED:'..#anode)
--                        print('?? for_scope:'..tostring(W.forScope())..':'..nm)
--                    return W.mdown(rayCast, {R=R, D=D}) or nm ~= 'theTerrain'
@/lua/ge/extensions/flowgraph/nodes/scene/storeStatics.lua
  -- name will be generated to avoid duplicate names
  local name = "spawnedObj_" .. tostring(os.time()) .. "_" .. self.id..'_'.. #self.objects
  object:registerObject(name)
@/lua/ge/extensions/gameplay/drift/stallingSystem.lua
      stunt = history[i]
      id = tostring(stunt.stuntId)
      lastStunt = history[i - 1]
        for _, stuntj in ipairs(history) do
          buffer[tostring(stuntj.stuntId)] = {repetitions = 0}
        end
@/lua/ge/extensions/flowgraph/nodes/scene/idByName.lua
  im.Text(self.data.name)
  im.Text(tostring(self.objID))
end
@/lua/ge/extensions/career/modules/logbook.lua
    else
      return tostring(a.entryId) > tostring(b.entryId)
    end
    else
      return tostring(a.entryId) > tostring(b.entryId)
    end
@/lua/ge/extensions/gameplay/markers/crawlMarker.lua
    local cm = poi.markerInfo.crawlMarker
    local name = tostring(cm.pos)..tostring(cm.iconPos)
    poisByObjectNames[name] = poisByObjectNames[name] or {}
    local cm = poi.markerInfo.crawlMarker
    local name = tostring(cm.pos)..tostring(cm.iconPos)
    poisByObjectNames[name] = poisByObjectNames[name] or {}
@/lua/common/jbeam/slotSystem.lua
  local source = deepcopy(source_raw)
  --log('I', "jbeam.unifyParts",string.rep(" ", level).."* merging part "..tostring(source.partName).."{".. tostring(source) .. "}["..dumps(source.slotType).."] => "..tostring(target.partName).." ["..tostring(target.slotType).."] ... ")
  -- walk and merge all sections
  local source = deepcopy(source_raw)
  --log('I', "jbeam.unifyParts",string.rep(" ", level).."* merging part "..tostring(source.partName).."{".. tostring(source) .. "}["..dumps(source.slotType).."] => "..tostring(target.partName).." ["..tostring(target.slotType).."] ... ")
  -- walk and merge all sections
  local source = deepcopy(source_raw)
  --log('I', "jbeam.unifyParts",string.rep(" ", level).."* merging part "..tostring(source.partName).."{".. tostring(source) .. "}["..dumps(source.slotType).."] => "..tostring(target.partName).." ["..tostring(target.slotType).."] ... ")
  -- walk and merge all sections
  local source = deepcopy(source_raw)
  --log('I', "jbeam.unifyParts",string.rep(" ", level).."* merging part "..tostring(source.partName).."{".. tostring(source) .. "}["..dumps(source.slotType).."] => "..tostring(target.partName).." ["..tostring(target.slotType).."] ... ")
  -- walk and merge all sections

    --log('D', "jbeam.unifyParts"," *** "..tostring(sectionKey).." = "..tostring(section).." ["..type(section).."] -> "..tostring(sectionKey).." = "..tostring(target[sectionKey]).." ["..type(target[sectionKey]).."]")
    if target[sectionKey] == nil then

    --log('D', "jbeam.unifyParts"," *** "..tostring(sectionKey).." = "..tostring(section).." ["..type(section).."] -> "..tostring(sectionKey).." = "..tostring(target[sectionKey]).." ["..type(target[sectionKey]).."]")
    if target[sectionKey] == nil then

    --log('D', "jbeam.unifyParts"," *** "..tostring(sectionKey).." = "..tostring(section).." ["..type(section).."] -> "..tostring(sectionKey).." = "..tostring(target[sectionKey]).." ["..type(target[sectionKey]).."]")
    if target[sectionKey] == nil then

    --log('D', "jbeam.unifyParts"," *** "..tostring(sectionKey).." = "..tostring(section).." ["..type(section).."] -> "..tostring(sectionKey).." = "..tostring(target[sectionKey]).." ["..type(target[sectionKey]).."]")
    if target[sectionKey] == nil then
        if not partFitsSlot(chosenPart, slotDef) then
          log('E', 'slotSystem', 'Chosen part has wrong slot type. Required is ' .. tostring(slotDef.type) .. ' provided by part ' .. tostring(userPartName) .. ' is ' .. dumps(chosenPart.slotType) .. '. Resetting to default')
          chosenPart, chosenPartName = nil, nil
        if not partFitsSlot(chosenPart, slotDef) then
          log('E', 'slotSystem', 'Chosen part has wrong slot type. Required is ' .. tostring(slotDef.type) .. ' provided by part ' .. tostring(userPartName) .. ' is ' .. dumps(chosenPart.slotType) .. '. Resetting to default')
          chosenPart, chosenPartName = nil, nil
      else
        log('E', "jbeam.fillSlots", 'slot "' .. tostring(slotId) .. '" reset to default part "' .. tostring(slotDef.default) .. '" as the wished part "' .. tostring(userPartName) .. '" was not found')
      end
      else
        log('E', "jbeam.fillSlots", 'slot "' .. tostring(slotId) .. '" reset to default part "' .. tostring(slotDef.default) .. '" as the wished part "' .. tostring(userPartName) .. '" was not found')
      end
      else
        log('E', "jbeam.fillSlots", 'slot "' .. tostring(slotId) .. '" reset to default part "' .. tostring(slotDef.default) .. '" as the wished part "' .. tostring(userPartName) .. '" was not found')
      end
      -- if userPartName ~= chosenPartName then
      --   dump{"wished for part:" .. tostring(userPartName) .. " found part:" .. tostring(chosenPartName) .. " reason:" .. tostring(slotTreeEntry.decisionMethod)}
      -- end
      -- if userPartName ~= chosenPartName then
      --   dump{"wished for part:" .. tostring(userPartName) .. " found part:" .. tostring(chosenPartName) .. " reason:" .. tostring(slotTreeEntry.decisionMethod)}
      -- end
      -- if userPartName ~= chosenPartName then
      --   dump{"wished for part:" .. tostring(userPartName) .. " found part:" .. tostring(chosenPartName) .. " reason:" .. tostring(slotTreeEntry.decisionMethod)}
      -- end
      if userPartName and userPartName ~= '' then
        log('E', "jbeam.fillSlots", 'slot "' .. tostring(slotId) .. '" left empty as part "' .. tostring(userPartName) .. '" was not found')
      else
      if userPartName and userPartName ~= '' then
        log('E', "jbeam.fillSlots", 'slot "' .. tostring(slotId) .. '" left empty as part "' .. tostring(userPartName) .. '" was not found')
      else
      else
        --log('D', "jbeam.fillSlots", "no suitable part found for type: " .. tostring(slot.type))
      end
@/lua/common/utils/httpJsonServer.lua
        if err == 'closed' then return end
        log('E', 'httpJsonServer', "client.receive error: " .. tostring(err))
        return
                if err == 'closed' then return end
                log('E', 'httpJsonServer', "client.receive error: " .. tostring(err))
                return nil
            local res, err = ltn12.pump.step(sinkData[2], sinkData[3])
            --print(tostring(res))
            --print(tostring(err))
            --print(tostring(res))
            --print(tostring(err))
            if res then
@/lua/ge/extensions/flowgraph/nodes/vehicle/vehicleConfigProvider.lua
  builder:Middle()
  im.Text(tostring(self.modelName))
  im.Text(tostring(self.configName))
  im.Text(tostring(self.modelName))
  im.Text(tostring(self.configName))
@/lua/ge/extensions/ui/uiNavi.lua
  -- local tmpmap = deepcopy(m) -- since we are always just create a new object out of primitive data types in the function below we don't need this copy here
  local oldSize = tostring(string.len(jsonEncode(tmpmap.nodes)))
  local newNodes = {}
  end
  -- print('new node list size (char): ' .. tostring(string.len(jsonEncode(newNodes))) .. ' (used to be: ' .. oldSize .. ', nr nodes: '.. tostring(counter - 2) .. ')')
  return newNodes
  end
  -- print('new node list size (char): ' .. tostring(string.len(jsonEncode(newNodes))) .. ' (used to be: ' .. oldSize .. ', nr nodes: '.. tostring(counter - 2) .. ')')
  return newNodes
@/lua/ge/extensions/util/instancedLineRenderDemo.lua
  drawgrid(gridSize, rot, origin + vec3(gridSize * 3, 0, z), true, width)
  debugDrawer:drawText(origin + vec3(gridSize * 3, -0.5, z), String('grid line width = ' .. tostring(width)), ColorF(0, 0, 0, 1))
end
    local elCount = drawSin(t, pos, i, step)
    local txt = 'w = ' .. tostring(i) .. ', elements = ' .. tostring(elCount)
    debugDrawer:drawText(pos, String(txt), ColorF(0, 0, 0, 1))
    local elCount = drawSin(t, pos, i, step)
    local txt = 'w = ' .. tostring(i) .. ', elements = ' .. tostring(elCount)
    debugDrawer:drawText(pos, String(txt), ColorF(0, 0, 0, 1))
@/lua/common/libs/luasocket/socket/http.lua
    socket.try(nreqt.host and nreqt.host ~= "", 
        "invalid host '" .. base.tostring(nreqt.host) .. "'")
    -- compute uri if user hasn't overriden
@/lua/vehicle/controller/pneumatics/airbrakes.lua

  --log("D", "airbrakes.updateFixedStep", "pressureDiff: " .. tostring(pressureDiff))
  --log("D", "airbrakes.updateFixedStep", "flowRate: " .. tostring(flowRate))
  --log("D", "airbrakes.updateFixedStep", "pressureDiff: " .. tostring(pressureDiff))
  --log("D", "airbrakes.updateFixedStep", "flowRate: " .. tostring(flowRate))
  --log("D", "airbrakes.updateFixedStep", "airVolumeMoved: " .. tostring(airVolumeMoved))
  --log("D", "airbrakes.updateFixedStep", "flowRate: " .. tostring(flowRate))
  --log("D", "airbrakes.updateFixedStep", "airVolumeMoved: " .. tostring(airVolumeMoved))
  --log("D", "airbrakes.updateFixedStep", "airEnergyMoved: " .. tostring(airEnergyMoved))
  --log("D", "airbrakes.updateFixedStep", "airVolumeMoved: " .. tostring(airVolumeMoved))
  --log("D", "airbrakes.updateFixedStep", "airEnergyMoved: " .. tostring(airEnergyMoved))

  --log("D", "airbrakes.updateFixedStep", "energyTransferred: " .. tostring(energyTransferred))

  --log("D", "airbrakes.updateFixedStep", "energyTransferred: " .. tostring(energyTransferred))
@/gameplay/tutorials/customNodes/blacklistedCarsNode.lua
  for id,car in pairs(self.mgr._fgTutoTestCarsStep.carsData) do
    self.pinOut["car"..tostring(car.id).."Blacklisted"].value = car.blacklisted
  end
@/lua/common/tech/pcdLib.lua
  end
  return tostring(x)
end
  self:writeHeader(file)
  file:write(payload:tostring())
  file:flush()
@/lua/ge/extensions/gameplay/rally/client.lua
    log('E', logTag, 'rally client error: '..dumps(code))
    return {ok = false, error = tostring(code)}
  else
  else
    --print('body:' .. tostring(body))
    --print('code:' .. tostring(code))
    --print('body:' .. tostring(body))
    --print('code:' .. tostring(code))
    --print('headers:' .. dumps(headers))
    --print('headers:' .. dumps(headers))
    --print('status:' .. tostring(status))
    local rv = jsonDecode(table.concat(respbody), 'json request response')
    log('E', logTag, 'rally client error: '..dumps(code))
    return {ok = false, error = tostring(code)}
  else
--   local req = {
--     created_at = tostring(rallyUtil.getTime()),
--     method= 'POST',
@/lua/ge/extensions/editor/assetBrowser.lua
local function materialContextMenu(material)
  if im.BeginPopup("ContextMenu_Material_" .. tostring(material.id)) then
    for _, entry in ipairs(var.assetContextMenuEntries) do
  local itemDoubleClicked = false
  if im.SmallButton(dir.name .. "##" .. tostring(dir.id)) then
    var.currentListIndex = var.listIndexCounter
    -- [debug]
    -- im.SmallButton((parentDir == true) and ("[...]##parentDir" .. dir.path) or (tostring(im.GetCursorPosY()) .. " " .. dir.name .. "##" .. dir.path))
    if dir.selectedInABView == true then im.PushStyleColor2(im.Col_Text, im.GetStyleColorVec4(im.Col_ButtonActive)) end -- set SmallButton's font color to if the asset is selected
    -- [Debug]
    -- im.SmallButton(tostring(var.itemPos) .. " " .. tostring(im.GetCursorPosY()) .. " " .. material.fullFileName)
    if im.SmallButton(material.name) then
    -- [Debug]
    -- im.SmallButton(tostring(var.itemPos) .. " " .. tostring(im.GetCursorPosY()) .. " " .. material.fullFileName)
    if im.SmallButton(material.name) then
    elseif im.IsItemClicked(1) then
      im.OpenPopup("ContextMenu_Material_" .. tostring(material.id))
    end
      local buttonWidth = im.CalcTextSize(file.fullFileName).x + 2 * var.style.FramePadding.x
      if im.Button("##" .. tostring(file.id), im.ImVec2(buttonWidth,var.fontSize)) then
        selectAsset(file)
  im.SetCursorPos(im.ImVec2(cPosStart.x + var.fontSize + 3 * var.style.FramePadding.x, cPosStart.y + var.style.FramePadding.y))
  im.TextUnformatted(group.identifier .. " (" .. tostring(#var.filteredAssetGroups[group.identifier]) .. ")")
  im.SetCursorPos(cPosEnd)
      else
        im.TextUnformatted("Loading assets (" .. tostring(var.assetsProcessed) .. "/" .. tostring(var.numberOfAllAssetsAndDirs) ..")")
        im.TextUnformatted(string.format("%0.2f",(var.assetsProcessed/var.numberOfAllAssetsAndDirs)*100) .. '%')
      else
        im.TextUnformatted("Loading assets (" .. tostring(var.assetsProcessed) .. "/" .. tostring(var.numberOfAllAssetsAndDirs) ..")")
        im.TextUnformatted(string.format("%0.2f",(var.assetsProcessed/var.numberOfAllAssetsAndDirs)*100) .. '%')
  for k, dir in ipairs(var.selectedDirectory.pathToRoot) do
    if im.Button(dir.name .. "##breadcrump" .. tostring(dir.id)) then
      selectDirectory(dir, nil, nil, true)
  -- Add button for the current selected directory.
  im.Button(var.selectedDirectory.name .. "##breadcrumb" .. tostring(var.selectedDirectory.id))
  im.NextColumn()
  im.TextUnformatted(tostring(value))
  im.NextColumn()
  im.NextColumn()
  im.TextUnformatted("x: " .. tostring(value.x) .. "   y: " .. tostring(value.y))
  im.NextColumn()
  im.NextColumn()
  im.TextUnformatted("x: " .. tostring(value.x) .. "   y: " .. tostring(value.y))
  im.NextColumn()
            im.SameLine()
            if var.imageInspectorImageSize then im.TextUnformatted("Image preview size x: " .. tostring(var.imageInspectorImageSize.x) .. " y: " .. tostring(var.imageInspectorImageSize.y)) end
        end
            im.SameLine()
            if var.imageInspectorImageSize then im.TextUnformatted("Image preview size x: " .. tostring(var.imageInspectorImageSize.x) .. " y: " .. tostring(var.imageInspectorImageSize.y)) end
        end
      im.NextColumn()
      im.TextUnformatted(tostring(var.meshPreview.mDetailPolys))
      im.NextColumn()
      im.NextColumn()
      im.TextUnformatted(tostring(var.meshPreview.mColPolys))
      im.NextColumn()
      for k, directory in ipairs(directoriesToLoadRef) do
        if im.InputText("##DirName" .. tostring(k), editor.getTempCharPtr(directory.name)) then
          directoriesToLoadRef[k].name = editor.getTempCharPtr()
        im.NextColumn()
        if im.InputText("##DirPath" .. tostring(k), editor.getTempCharPtr(directory.path)) then
          directoriesToLoadRef[k].path = editor.getTempCharPtr()
        im.NextColumn()
        if im.Button("Delete##directoryToLoad" .. tostring(k)) then
          local newDirectoriesToLoad = deepcopy(directoriesToLoadRef)
@/lua/ge/extensions/editor/roadArchitect.lua
            local flag = i == mfe.selectedRoadIdx
            if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
              table.clear(roadMgr.multi)
            im.PushItemWidth(180)
            im.InputText("###" .. tostring(wCtr), road.displayName, 32)
            im.PopItemWidth()

            im.Checkbox("Show###" .. tostring(wCtr), road.isVis)
            im.tooltip('Show this road in edit visualisation (checked), or not (unchecked).')
                cols.greenB,
                tostring(road.groupIdx[1]) .. " " ..
                tostring(road.groupIdx[2] or '') .. " " ..
                tostring(road.groupIdx[1]) .. " " ..
                tostring(road.groupIdx[2] or '') .. " " ..
                tostring(road.groupIdx[3] or '') .. " " ..
                tostring(road.groupIdx[2] or '') .. " " ..
                tostring(road.groupIdx[3] or '') .. " " ..
                tostring(road.groupIdx[4] or '') .. " " ..
                tostring(road.groupIdx[3] or '') .. " " ..
                tostring(road.groupIdx[4] or '') .. " " ..
                tostring(road.groupIdx[5] or ''))
                tostring(road.groupIdx[4] or '') .. " " ..
                tostring(road.groupIdx[5] or ''))
            else
              local flag = i == mfe.selectedNodeIdx or doesMultiContain(mfe.selectedRoadIdx, i, roadMgr.multi)
              if im.Selectable1('Node [' .. tostring(i) .. ']', flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                table.clear(roadMgr.multi)
                  local flag = i == mfe.selectedLayerIdx
                  if im.Selectable1(tostring(i) .. "###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                    mfe.selectedLayerIdx = max(1, min(numLayers, i))
                  local flag = i == mfe.selectedLayerIdx
                  if im.Selectable1(tostring(i) .. "###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                    mfe.selectedLayerIdx = max(1, min(numLayers, i))
                  im.PushItemWidth(150)
                  if im.InputText("###" .. tostring(wCtr), layer.name, 32) then
                    mfe.selectedLayerIdx = max(1, min(numLayers, i))
                  -- 'Show On Visualisation' checkbox.
                  if im.Checkbox("Show###" .. tostring(wCtr), layer.isDisplay) then
                    mfe.selectedLayerIdx = max(1, min(numLayers, i))
              im.Columns(4)
              im.RadioButton2("L-Span###" .. tostring(wCtr), layer.type, 0)
              im.tooltip('A longitudinal layer which spans a lane/multiple adjacent lanes.')
              im.NextColumn()
              im.RadioButton2("Offset###" .. tostring(wCtr), layer.type, 1)
              im.tooltip('A longitudinal layer which has a fixed width, and is offset from one side of a lane.')
              im.NextColumn()
              im.RadioButton2("Patch###" .. tostring(wCtr), layer.type, 2)
              im.tooltip('A single-instance layer, at some chosen position along the road. Spans a lane/multiple lanes.')
              im.NextColumn()
              im.RadioButton2("Decal###" .. tostring(wCtr), layer.type, 3)
              im.tooltip('A single-instance layer, at some chosen position along the road, and indexes a larger tiled-material. Has a fixed size.')
              im.Columns(2)
              im.RadioButton2("Road-Span Mesh###" .. tostring(wCtr), layer.type, 4)
              im.tooltip('A road-spanning layer comprised of adjacent static mesh units.')
              im.NextColumn()
              im.RadioButton2("Single Mesh###" .. tostring(wCtr), layer.type, 5)
              im.tooltip('A single-instance static mesh, at some chosen position along the road.')
                  im.PushItemWidth(-150)
                  if im.InputFloat("Texture Length###" .. tostring(wCtr), layer.texLen, 0.1, 0.0) then
                    layer.texLen = im.FloatPtr(max(1.0, min(200.0, layer.texLen[0])))
                end
                im.tooltip('Select a new material for layer ' .. tostring(selLayerIdx))
                im.SameLine()
                im.Text(layer.mat or 'None')
                im.tooltip('The currently-selected material for layer ' .. tostring(selLayerIdx))
                im.NextColumn()
                  local oldVal = layer.laneMin[0]
                  im.InputInt("Min Lane Index###" .. tostring(wCtr), layer.laneMin, 1)
                  im.tooltip('The index of the left-most lane, from which this layer will span.')
                  local oldVal = layer.laneMax[0]
                  im.InputInt("Max Lane Index###" .. tostring(wCtr), layer.laneMax, 1)
                  im.tooltip('The index of the right-most lane, to which this layer will span.')
                  local oldVal = layer.lane[0]
                  im.InputInt("Lane Index###" .. tostring(wCtr), layer.lane, 1)
                  im.tooltip('The index of the lane to which this layer is attached.')
                end
                im.InputFloat("Layer Position###" .. tostring(wCtr), layer.off, fScale, 0.0)
                wCtr = wCtr + 1
                if layerType == 1 or layerType == 2 then
                  im.InputFloat("Layer Width###" .. tostring(wCtr), layer.width, 0.1, 0.0)
                  layer.width = im.FloatPtr(max(0.01, min(30.0, layer.width[0])))
                  wCtr = wCtr + 1
                  im.tooltip('Set the width of layer ' .. tostring(selLayerIdx))
                end
                if layerType == 3 then
                  im.InputFloat("Lateral Offset###" .. tostring(wCtr), layer.pos, 0.1, 0.0)
                  wCtr = wCtr + 1

                  im.InputInt("Material: Num Rows###" .. tostring(wCtr), layer.numRows, 1)
                  layer.numRows = im.IntPtr(max(1, min(99, layer.numRows[0])))

                  im.InputInt("Material: Num Columns###" .. tostring(wCtr), layer.numCols, 1)
                  layer.numCols = im.IntPtr(max(1, min(99, layer.numCols[0])))

                  im.InputInt("Frame Number###" .. tostring(wCtr), layer.frame, 1)
                  layer.frame = im.IntPtr(max(0, min(layer.numRows[0] * layer.numCols[0], layer.frame[0])))

                  im.InputFloat("Decal Size###" .. tostring(wCtr), layer.size, 0.1, 0.0)
                  wCtr = wCtr + 1
                if layerType == 1 or layerType == 3 then
                  im.Checkbox("Attach Left/Right###" .. tostring(wCtr), layer.isLeft)
                  wCtr = wCtr + 1
                  im.Columns(4)
                  im.RadioButton2("0###" .. tostring(wCtr), layer.rot, 0)
                  wCtr = wCtr + 1
                  im.NextColumn()
                  im.RadioButton2("90###" .. tostring(wCtr), layer.rot, 1)
                  wCtr = wCtr + 1
                  im.NextColumn()
                  im.RadioButton2("180###" .. tostring(wCtr), layer.rot, 2)
                  wCtr = wCtr + 1
                  im.NextColumn()
                  im.RadioButton2("270###" .. tostring(wCtr), layer.rot, 3)
                  wCtr = wCtr + 1
                  im.Columns(2, 'type1or2ExtraColsB', false)
                  im.Checkbox("Span Road Length###" .. tostring(wCtr), layer.isSpanLong)
                  wCtr = wCtr + 1
                  im.NextColumn()
                  im.Checkbox("Finish Before Ends###" .. tostring(wCtr), layer.isPaint)
                  wCtr = wCtr + 1
                  if not layer.isSpanLong[0] then
                    im.InputInt("Min Node Index###" .. tostring(wCtr), layer.nMin, 1)
                    layer.nMin = im.IntPtr(max(1, min(layer.nMax[0], min(#road.nodes or 1, layer.nMin[0]))))
                    im.tooltip('The start node index, for this layer.')
                    im.InputInt("Max Node Index###" .. tostring(wCtr), layer.nMax, 1)
                    layer.nMax = im.IntPtr(max(layer.nMin[0] , max(1, min(#road.nodes or 1, layer.nMax[0]))))

                  im.InputFloat("Fade-In [Start]###" .. tostring(wCtr), layer.fadeS, 0.01, 0.0)
                  layer.fadeS = im.FloatPtr(max(0.0, min(100.0, layer.fadeS[0])))
                  wCtr = wCtr + 1
                  im.tooltip('Set the fade-in value of layer ' .. tostring(selLayerIdx))
                  im.InputFloat("Fade-Out [End]###" .. tostring(wCtr), layer.fadeE, 0.01, 0.0)
                  im.tooltip('Set the fade-in value of layer ' .. tostring(selLayerIdx))
                  im.InputFloat("Fade-Out [End]###" .. tostring(wCtr), layer.fadeE, 0.01, 0.0)
                  layer.fadeE = im.FloatPtr(max(0.0, min(100.0, layer.fadeE[0])))
                  wCtr = wCtr + 1
                  im.tooltip('Set the fade-out value of layer ' .. tostring(selLayerIdx))
                end
                  im.TextColored(cols.greenB, 'General Properties:')
                  im.Checkbox("Reverse###" .. tostring(wCtr), layer.isReverse)
                  wCtr = wCtr + 1
                im.Columns(2, 'singleMeshUnitTopRowCols', false)
                im.Checkbox("Span Road Length###" .. tostring(wCtr), layer.isSpanLong)
                wCtr = wCtr + 1

                im.Checkbox("Attach To Left/Right###" .. tostring(wCtr), layer.isLeft)
                wCtr = wCtr + 1
                  im.PushItemWidth(-150)
                  im.InputInt("Node Index [Min]###" .. tostring(wCtr), layer.nMin, 1)
                  layer.nMin = im.IntPtr(max(1, min(layer.nMax[0], min(#road.nodes or 1, layer.nMin[0]))))
                  im.tooltip('The start node index, for this layer.')
                  im.InputInt("Node Index [Max]###" .. tostring(wCtr), layer.nMax, 1)
                  layer.nMax = im.IntPtr(max(layer.nMin[0] , max(1, min(#road.nodes or 1, layer.nMax[0]))))

                im.Checkbox("Use World Z-Value###" .. tostring(wCtr), layer.useWorldZ)
                wCtr = wCtr + 1
                im.PushStyleVar1(im.StyleVar_GrabMinSize, 20)
                im.InputFloat("Spacing Between Units###" .. tostring(wCtr), layer.spacing, 0.1, 0.0)
                layer.spacing = im.FloatPtr(max(-0.2, min(200.0, layer.spacing[0])))
                local oldVal = layer.lane[0]
                im.InputInt("Lane Index###" .. tostring(wCtr), layer.lane, 1)
                im.tooltip('The index of the lane to which this mesh unit is attached.')
                im.tooltip('Set the vertical offset of the custom mesh.')
                im.InputFloat("Lateral Offset###" .. tostring(wCtr), layer.latOffset, 0.1, 0.0)
                layer.latOffset = im.FloatPtr(max(-100.0, min(100.0, layer.latOffset[0])))
                wCtr = wCtr + 1
                im.InputFloat("Vertical Offset###" .. tostring(wCtr), layer.vertOffset, 0.1, 0.0)
                layer.vertOffset = im.FloatPtr(max(-100.0, min(100.0, layer.vertOffset[0])))
                im.tooltip('Set the lateral offset of the custom mesh.')
                im.InputFloat("Amount Of Jitter###" .. tostring(wCtr), layer.jitter, 0.001, 0.0)
                layer.jitter = im.FloatPtr(max(0.0, min(0.2, layer.jitter[0])))
                im.Columns(4)
                im.RadioButton2("0###" .. tostring(wCtr), layer.rot, 0)
                wCtr = wCtr + 1
                im.NextColumn()
                im.RadioButton2("90###" .. tostring(wCtr), layer.rot, 1)
                wCtr = wCtr + 1
                im.NextColumn()
                im.RadioButton2("180###" .. tostring(wCtr), layer.rot, 2)
                wCtr = wCtr + 1
                im.NextColumn()
                im.RadioButton2("270###" .. tostring(wCtr), layer.rot, 3)
                wCtr = wCtr + 1
                local oldVal = layer.lane[0]
                im.InputInt("Lane Index###" .. tostring(wCtr), layer.lane, 1)
                im.tooltip('The index of the lane to which this mesh unit is attached.')

                im.Checkbox("Attach To Left/Right###" .. tostring(wCtr), layer.isLeft)
                wCtr = wCtr + 1

                im.InputFloat("Position###" .. tostring(wCtr), layer.pos, 0.001, 0.0)
                layer.pos = im.FloatPtr(max(0.0, min(1.0, layer.pos[0])))

                im.InputFloat("Lateral Offset###" .. tostring(wCtr), layer.latOffset, 0.1, 0.0)
                layer.latOffset = im.FloatPtr(max(-20.0, min(20.0, layer.latOffset[0])))

                im.InputFloat("Vertical Offset###" .. tostring(wCtr), layer.vertOffset, 0.1, 0.0)
                layer.vertOffset = im.FloatPtr(max(-20.0, min(20.0, layer.vertOffset[0])))
                im.Columns(4)
                im.RadioButton2("0###" .. tostring(wCtr), layer.rot, 0)
                wCtr = wCtr + 1
                im.NextColumn()
                im.RadioButton2("90###" .. tostring(wCtr), layer.rot, 1)
                wCtr = wCtr + 1
                im.NextColumn()
                im.RadioButton2("180###" .. tostring(wCtr), layer.rot, 2)
                wCtr = wCtr + 1
                im.NextColumn()
                im.RadioButton2("270###" .. tostring(wCtr), layer.rot, 3)
                wCtr = wCtr + 1
                  local flag = iii == mfe.selectedSidewalkIdx
                  if im.Selectable1(tostring(iii) .. "###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                    mfe.selectedSidewalkIdx = iii
                  local flag = iii == mfe.selectedSidewalkIdx
                  if im.Selectable1(tostring(iii) .. "###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                    mfe.selectedSidewalkIdx = iii
              im.PushItemWidth(-150)
              im.Checkbox("Left Side###" .. tostring(wCtr), profile[selSW].isLeftSide)
              wCtr = wCtr + 1
              im.PushStyleVar1(im.StyleVar_GrabMinSize, 20)
              if im.InputFloat("Curb Width###" .. tostring(wCtr), profile[selSW].kerbWidth, 0.1, 0.0) then
                profile[selSW].kerbWidth = im.FloatPtr(max(0.05, min(10.0, profile[selSW].kerbWidth[0])))
              -- 'Curb Corner Lateral Offset' input box.
              if im.InputFloat("Curb Lateral Offset###" .. tostring(wCtr), profile[selSW].cornerLatOff, 0.01, 0.0) then
                profile[selSW].cornerLatOff = im.FloatPtr(max(-0.3, min(0.3, profile[selSW].cornerLatOff[0])))
              -- 'Curb Corner Height Offset' input box.
              if im.InputFloat("Vertical Offset###" .. tostring(wCtr), profile[selSW].cornerDrop, 0.01, 0.0) then
                profile[selSW].cornerDrop = im.FloatPtr(max(-0.1, min(0.1, profile[selSW].cornerDrop[0])))
              im.Columns(4)
              im.RadioButton2("[A]###" .. tostring(wCtr), profile[selSW].vStart, 0)
              wCtr = wCtr + 1
              im.NextColumn()
              im.RadioButton2("[B]###" .. tostring(wCtr), profile[selSW].vStart, 1)
              wCtr = wCtr + 1
              im.NextColumn()
              im.RadioButton2("[C]###" .. tostring(wCtr), profile[selSW].vStart, 2)
              wCtr = wCtr + 1
              im.NextColumn()
              im.RadioButton2("[D]###" .. tostring(wCtr), profile[selSW].vStart, 3)
              wCtr = wCtr + 1
          local flag = i == mfe.selectedJctIdx
          if im.Selectable1(tostring(i) .. "###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            mfe.selectedJctIdx = max(1, min(#junctions, i))
          local flag = i == mfe.selectedJctIdx
          if im.Selectable1(tostring(i) .. "###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            mfe.selectedJctIdx = max(1, min(#junctions, i))
          im.PushItemWidth(150)
          im.InputText("###" .. tostring(wCtr), jct.name, 32)
          im.PopItemWidth()
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("L Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Exit Len###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(0.5, min(20.0, selJct.capLength[0])))
          im.Columns(2, 'jctSidewalkCols_row2', false)
          if im.Checkbox("Sidewalk###" .. tostring(wCtr), selJct.isSidewalk) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.Checkbox("Low Corners###" .. tostring(wCtr), selJct.isLowerSWAtPedX) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.InputFloat("Sidewalk Width###" .. tostring(wCtr), selJct.sidewalkWidth, 0.1, 2.0) then
              selJct.sidewalkWidth = im.FloatPtr(max(0.5, min(10.0, selJct.sidewalkWidth[0])))

            if im.InputFloat("Sidewalk Height###" .. tostring(wCtr), selJct.sidewalkHeight, 0.01, 0.1) then
              jctMgr.updateJunctionAfterChange(selJctIdx)

          if im.InputFloat("Crossing Length###" .. tostring(wCtr), selJct.pedXDist, 0.1, 0.0) then
            selJct.pedXDist = im.FloatPtr(max(2.0, min(30.0, selJct.pedXDist[0])))
          im.TextColored(cols.greenB, 'Traffic Light Parameters:')
          if im.Checkbox("Include Traffic Lights###" .. tostring(wCtr), selJct.isTLights) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isTLights[0] then
            if im.InputFloat("Pole Lateral Offset###" .. tostring(wCtr), selJct.trafficLatOff, 0.1, 2.0) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Pedestrian Crossing Parameters:')
          if im.Checkbox("Ped X###" .. tostring(wCtr), selJct.isPedX1) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isPedX1[0] then
            if im.InputFloat("Crossing Width###" .. tostring(wCtr), selJct.pedXWidth, 0.1, 0.0) then
              selJct.pedXWidth = im.FloatPtr(max(0.5, min(5.0, selJct.pedXWidth[0])))
          im.TextColored(cols.greenB, 'Traffic Sign Parameters:')
          if im.Checkbox("Include Traffic Signs###" .. tostring(wCtr), selJct.isSigns) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Num Lanes - X Dir###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputInt("Num Lanes - Y Dir###" .. tostring(wCtr), selJct.numLanesY, 1) then
            selJct.numLanesY = im.IntPtr(max(1, min(6, selJct.numLanesY[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(0.5, min(20.0, selJct.capLength[0])))

          if im.Checkbox("Is Y One-Way###" .. tostring(wCtr), selJct.isYOneWay) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
            im.Columns(2, 'crossroadsYDirCols1', false)
            if im.Checkbox("Y1 Out/In###" .. tostring(wCtr), selJct.isY1Outwards) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
            im.NextColumn()
            if im.Checkbox("Y2 Out/In###" .. tostring(wCtr), selJct.isY2Outwards) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(2, 'jctSidewalkCols_row2', false)
          if im.Checkbox("Sidewalk###" .. tostring(wCtr), selJct.isSidewalk) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.Checkbox("Low Corners###" .. tostring(wCtr), selJct.isLowerSWAtPedX) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.InputFloat("Sidewalk Width###" .. tostring(wCtr), selJct.sidewalkWidth, 0.1, 2.0) then
              selJct.sidewalkWidth = im.FloatPtr(max(0.5, min(10.0, selJct.sidewalkWidth[0])))

            if im.InputFloat("Sidewalk Height###" .. tostring(wCtr), selJct.sidewalkHeight, 0.01, 0.1) then
              jctMgr.updateJunctionAfterChange(selJctIdx)

            if im.InputFloat("Sidewalk Corner Radius###" .. tostring(wCtr), selJct.bevel, 0.1, 2.0) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Traffic Light Parameters:')
          if im.Checkbox("Traffic Lights###" .. tostring(wCtr), selJct.isTLights) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isTLights[0] then
            if im.InputFloat("Pole Lateral Offset###" .. tostring(wCtr), selJct.trafficLatOff, 0.1, 2.0) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(4, 'jctPedXCheckboxesCols1', false)
          if im.Checkbox("PX 1###" .. tostring(wCtr), selJct.isPedX1) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("PX 2###" .. tostring(wCtr), selJct.isPedX2) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("PX 3###" .. tostring(wCtr), selJct.isPedX3) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("PX 4###" .. tostring(wCtr), selJct.isPedX4) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if isPedXBeingUsed then
            if im.InputFloat("Crossing Width###" .. tostring(wCtr), selJct.pedXWidth, 0.1, 0.0) then
              selJct.pedXWidth = im.FloatPtr(max(0.5, min(5.0, selJct.pedXWidth[0])))
          im.Columns(2, 'arrowCols1', false)
          if im.Checkbox("Front Arrows###" .. tostring(wCtr), selJct.isArrow) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isArrow[0] then
            if im.Checkbox("Rear Arrows###" .. tostring(wCtr), selJct.isDoubleArrows) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(1)
          if im.InputFloat("Arrow Size###" .. tostring(wCtr), selJct.arrowSize, 0.01, 0.0) then
            selJct.arrowSize = im.FloatPtr(max(0.5, min(4.5, selJct.arrowSize[0])))
          im.tooltip('The size of the arrow decals.')
          if im.InputFloat("Front Arrow Distance###" .. tostring(wCtr), selJct.arrowFrontDistFromEnd, 0.01, 0.0) then
            selJct.arrowFrontDistFromEnd = im.FloatPtr(max(0.0, min(selJct.arrowBackDistFromEnd[0] - selJct.arrowSize[0], selJct.arrowFrontDistFromEnd[0])))
          im.tooltip('The distance from the junction, at which the front arrows shall appear.')
          if im.InputFloat("Rear Arrow Distance###" .. tostring(wCtr), selJct.arrowBackDistFromEnd, 0.01, 0.0) then
            selJct.arrowBackDistFromEnd = im.FloatPtr(max(selJct.arrowFrontDistFromEnd[0] + selJct.arrowSize[0], min(50.0, selJct.arrowBackDistFromEnd[0])))
          im.TextColored(cols.greenB, 'Traffic Sign Parameters:')
          if im.Checkbox("Traffic Signs###" .. tostring(wCtr), selJct.isSigns) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Tread Overlay Parameters:')
          if im.Checkbox("Include Tread Overlays###" .. tostring(wCtr), selJct.isCrossings) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Num Lanes - X Dir###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputInt("Num Lanes - Y Dir###" .. tostring(wCtr), selJct.numLanesY, 1) then
            selJct.numLanesY = im.IntPtr(max(1, min(6, selJct.numLanesY[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(0.5, min(20.0, selJct.capLength[0])))

          if im.Checkbox("Is Y One-Way###" .. tostring(wCtr), selJct.isYOneWay) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isYOneWay[0] then
            if im.Checkbox("Outwards/Inwards###" .. tostring(wCtr), selJct.isY2Outwards) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(2, 'jctSidewalkCols_row2', false)
          if im.Checkbox("Sidewalk###" .. tostring(wCtr), selJct.isSidewalk) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.Checkbox("Low Corners###" .. tostring(wCtr), selJct.isLowerSWAtPedX) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.InputFloat("Sidewalk Width###" .. tostring(wCtr), selJct.sidewalkWidth, 0.1, 2.0) then
              selJct.sidewalkWidth = im.FloatPtr(max(0.5, min(10.0, selJct.sidewalkWidth[0])))

            if im.InputFloat("Sidewalk Height###" .. tostring(wCtr), selJct.sidewalkHeight, 0.01, 0.1) then
              jctMgr.updateJunctionAfterChange(selJctIdx)

            if im.InputFloat("Curb Corner Radius###" .. tostring(wCtr), selJct.bevel, 0.1, 2.0) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Traffic Light Parameters:')
          if im.Checkbox("Include Traffic Lights###" .. tostring(wCtr), selJct.isTLights) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isTLights[0] then
            if im.InputFloat("Pole Lateral Offset###" .. tostring(wCtr), selJct.trafficLatOff, 0.1, 2.0) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(3, 'jctPedXCheckboxesCols1', false)
          if im.Checkbox("PX 1###" .. tostring(wCtr), selJct.isPedX1) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("PX 2###" .. tostring(wCtr), selJct.isPedX2) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("PX 3###" .. tostring(wCtr), selJct.isPedX3) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if isPedXBeingUsed then
            if im.InputFloat("Crossing Width###" .. tostring(wCtr), selJct.pedXWidth, 0.1, 0.0) then
              selJct.pedXWidth = im.FloatPtr(max(0.5, min(5.0, selJct.pedXWidth[0])))
          im.Columns(2, 'arrowCols1', false)
          if im.Checkbox("Front Arrows###" .. tostring(wCtr), selJct.isArrow) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isArrow[0] then
            if im.Checkbox("Back Arrows###" .. tostring(wCtr), selJct.isDoubleArrows) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(1)
          if im.InputFloat("Arrow Size###" .. tostring(wCtr), selJct.arrowSize, 0.01, 0.0) then
            selJct.arrowSize = im.FloatPtr(max(0.5, min(4.5, selJct.arrowSize[0])))
          im.tooltip('The size of the arrow decals.')
          if im.InputFloat("Front Arrow Distance###" .. tostring(wCtr), selJct.arrowFrontDistFromEnd, 0.01, 0.0) then
            selJct.arrowFrontDistFromEnd = im.FloatPtr(max(0.0, min(selJct.arrowBackDistFromEnd[0] - selJct.arrowSize[0], selJct.arrowFrontDistFromEnd[0])))
          im.tooltip('The distance from the junction, at which the front arrows shall appear.')
          if im.InputFloat("Rear Arrow Distance###" .. tostring(wCtr), selJct.arrowBackDistFromEnd, 0.01, 0.0) then
            selJct.arrowBackDistFromEnd = im.FloatPtr(max(selJct.arrowFrontDistFromEnd[0] + selJct.arrowSize[0], min(50.0, selJct.arrowBackDistFromEnd[0])))
          im.TextColored(cols.greenB, 'Traffic Sign Parameters:')
          if im.Checkbox("Include Traffic Signs###" .. tostring(wCtr), selJct.isSigns) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Tread Overlay Parameters:')
          if im.Checkbox("Include Tread Overlays###" .. tostring(wCtr), selJct.isCrossings) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Exit Road Parameters:')
          if im.InputFloat("Y-Exit Road Angle (deg)###" .. tostring(wCtr), selJct.theta, 1, 0.0) then
            selJct.theta = im.FloatPtr(max(-30.0, min(30.0, selJct.theta[0])))
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Number Of Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Exit Road Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(0.5, min(20.0, selJct.capLength[0])))
          im.TextColored(cols.greenB, 'Sidewalk Parameters:')
          if im.Checkbox("Include Sidewalks###" .. tostring(wCtr), selJct.isSidewalk) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.InputFloat("Sidewalk Width###" .. tostring(wCtr), selJct.sidewalkWidth, 0.1, 2.0) then
              selJct.sidewalkWidth = im.FloatPtr(max(0.5, min(10.0, selJct.sidewalkWidth[0])))

            if im.InputFloat("Sidewalk Height###" .. tostring(wCtr), selJct.sidewalkHeight, 0.01, 0.1) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Traffic Light Parameters:')
          if im.Checkbox("Include Traffic Lights###" .. tostring(wCtr), selJct.isTLights) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(3, 'jctPedXCheckboxesCols1', false)
          if im.Checkbox("PX 1###" .. tostring(wCtr), selJct.isPedX1) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("PX 2###" .. tostring(wCtr), selJct.isPedX2) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("PX 3###" .. tostring(wCtr), selJct.isPedX3) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if isPedXBeingUsed then
            if im.InputFloat("Crossing Width###" .. tostring(wCtr), selJct.pedXWidth, 0.1, 0.0) then
              selJct.pedXWidth = im.FloatPtr(max(0.5, min(5.0, selJct.pedXWidth[0])))
          im.Columns(2, 'arrowCols1', false)
          if im.Checkbox("Front Arrows###" .. tostring(wCtr), selJct.isArrow) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isArrow[0] then
            if im.Checkbox("Rear Arrows###" .. tostring(wCtr), selJct.isDoubleArrows) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(1)
          if im.InputFloat("Arrow Size###" .. tostring(wCtr), selJct.arrowSize, 0.01, 0.0) then
            selJct.arrowSize = im.FloatPtr(max(0.5, min(4.5, selJct.arrowSize[0])))
          im.tooltip('The size of the arrow decals.')
          if im.InputFloat("Front Arrow Distance###" .. tostring(wCtr), selJct.arrowFrontDistFromEnd, 0.01, 0.0) then
            selJct.arrowFrontDistFromEnd = im.FloatPtr(max(0.0, min(selJct.arrowBackDistFromEnd[0] - selJct.arrowSize[0], selJct.arrowFrontDistFromEnd[0])))
          im.tooltip('The distance from the junction, at which the front arrows shall appear.')
          if im.InputFloat("Rear Arrow Distance###" .. tostring(wCtr), selJct.arrowBackDistFromEnd, 0.01, 0.0) then
            selJct.arrowBackDistFromEnd = im.FloatPtr(max(selJct.arrowFrontDistFromEnd[0] + selJct.arrowSize[0], min(50.0, selJct.arrowBackDistFromEnd[0])))
          im.TextColored(cols.greenB, 'Traffic Sign Parameters:')
          if im.Checkbox("Include Traffic Signs###" .. tostring(wCtr), selJct.isSigns) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Tread Overlay Parameters:')
          if im.Checkbox("Include Tread Overlays###" .. tostring(wCtr), selJct.isCrossings) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Center Circle Parameters:')
          if im.InputFloat("Center Circle Radius (deg)###" .. tostring(wCtr), selJct.extraRadRB, 0.1, 0.0) then
            selJct.extraRadRB = im.FloatPtr(max(-5.0, min(20.0, selJct.extraRadRB[0])))
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Number Of Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(0.5, min(20.0, selJct.capLength[0])))
          im.Columns(2, 'jctSidewalkCols_row2', false)
          if im.Checkbox("Sidewalk###" .. tostring(wCtr), selJct.isSidewalk) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.Checkbox("Low Corners###" .. tostring(wCtr), selJct.isLowerSWAtPedX) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.InputFloat("Sidewalk Width###" .. tostring(wCtr), selJct.sidewalkWidth, 0.1, 2.0) then
              selJct.sidewalkWidth = im.FloatPtr(max(0.5, min(10.0, selJct.sidewalkWidth[0])))

            if im.InputFloat("Sidewalk Height###" .. tostring(wCtr), selJct.sidewalkHeight, 0.01, 0.1) then
              jctMgr.updateJunctionAfterChange(selJctIdx)

            if im.InputFloat("Sidewalk Corner Radius###" .. tostring(wCtr), selJct.bevel, 0.1, 2.0) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Traffic Light Parameters:')
          if im.Checkbox("Include Traffic Lights###" .. tostring(wCtr), selJct.isTLights) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isTLights[0] then
            if im.InputFloat("Poles Lateral Offset###" .. tostring(wCtr), selJct.trafficLatOff, 0.1, 2.0) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Traffic Sign Parameters:')
          if im.Checkbox("Include Traffic Signs###" .. tostring(wCtr), selJct.isSigns) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(4, 'jctPedXCheckboxesCols1', false)
          if im.Checkbox("PX 1###" .. tostring(wCtr), selJct.isPedX1) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("PX 2###" .. tostring(wCtr), selJct.isPedX2) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("PX 3###" .. tostring(wCtr), selJct.isPedX3) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("PX 4###" .. tostring(wCtr), selJct.isPedX4) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if isPedXBeingUsed then
            if im.InputFloat("Crossing Width###" .. tostring(wCtr), selJct.pedXWidth, 0.1, 0.0) then
              selJct.pedXWidth = im.FloatPtr(max(0.5, min(5.0, selJct.pedXWidth[0])))
          im.Columns(2, 'arrowCols1', false)
          if im.Checkbox("Front Arrows###" .. tostring(wCtr), selJct.isArrow) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isArrow[0] then
            if im.Checkbox("Rear Arrows###" .. tostring(wCtr), selJct.isDoubleArrows) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(1)
          if im.InputFloat("Arrow Size###" .. tostring(wCtr), selJct.arrowSize, 0.01, 0.0) then
            selJct.arrowSize = im.FloatPtr(max(0.5, min(4.5, selJct.arrowSize[0])))
          im.tooltip('The size of the arrow decals.')
          if im.InputFloat("Front Arrow Distance###" .. tostring(wCtr), selJct.arrowFrontDistFromEnd, 0.01, 0.0) then
            selJct.arrowFrontDistFromEnd = im.FloatPtr(max(0.0, min(selJct.arrowBackDistFromEnd[0] - selJct.arrowSize[0], selJct.arrowFrontDistFromEnd[0])))
          im.tooltip('The distance from the junction, at which the front arrows shall appear.')
          if im.InputFloat("Rear Arrow Distance###" .. tostring(wCtr), selJct.arrowBackDistFromEnd, 0.01, 0.0) then
            selJct.arrowBackDistFromEnd = im.FloatPtr(max(selJct.arrowFrontDistFromEnd[0] + selJct.arrowSize[0], min(50.0, selJct.arrowBackDistFromEnd[0])))
          im.TextColored(cols.greenB, 'Tread Overlay Parameters:')
          if im.Checkbox("Include Tread Overlays###" .. tostring(wCtr), selJct.isCrossings) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Number Of Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(0.5, min(20.0, selJct.capLength[0])))
          im.Columns(2, 'setYDirCols1', false)
          if im.Checkbox("Is Y One-Way###" .. tostring(wCtr), selJct.isYOneWay) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isYOneWay[0] then
            if im.Checkbox("Direction###" .. tostring(wCtr), selJct.isY1Outwards) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Sidewalk Parameters:')
          if im.InputFloat("Sidewalk Width###" .. tostring(wCtr), selJct.sidewalkWidth, 0.1, 2.0) then
            selJct.sidewalkWidth = im.FloatPtr(max(0.5, min(10.0, selJct.sidewalkWidth[0])))

          if im.InputFloat("Sidewalk Height###" .. tostring(wCtr), selJct.sidewalkHeight, 0.01, 0.1) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Number Of Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("Taper Section Length###" .. tostring(wCtr), selJct.s2Length, 0.1, 0.0) then
            selJct.s2Length = im.FloatPtr(max(1.0, min(80.0, selJct.s2Length[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(1.0, min(50.0, selJct.capLength[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Inner Taper Width###" .. tostring(wCtr), selJct.sepWidthI, 0.1, 0.0) then
            selJct.sepWidthI = im.FloatPtr(max(0.0, min(20.0, selJct.sepWidthI[0])))

          if im.InputFloat("Outer Taper Width###" .. tostring(wCtr), selJct.sepWidthO, 0.1, 0.0) then
            selJct.sepWidthO = im.FloatPtr(max(0.0, min(20.0, selJct.sepWidthO[0])))
          im.TextColored(cols.greenB, 'Sidewalk Parameters:')
          if im.Checkbox("Include Sidewalks###" .. tostring(wCtr), selJct.isSidewalk) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.InputFloat("Sidewalk Width###" .. tostring(wCtr), selJct.sidewalkWidth, 0.1, 2.0) then
              selJct.sidewalkWidth = im.FloatPtr(max(0.5, min(10.0, selJct.sidewalkWidth[0])))

            if im.InputFloat("Sidewalk Height###" .. tostring(wCtr), selJct.sidewalkHeight, 0.01, 0.1) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Number Of Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(0.5, min(20.0, selJct.capLength[0])))
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Number Of Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("Taper Section Length###" .. tostring(wCtr), selJct.s2Length, 0.1, 0.0) then
            selJct.s2Length = im.FloatPtr(max(1.0, min(80.0, selJct.s2Length[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(1.0, min(50.0, selJct.capLength[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Hard Shoulder Width###" .. tostring(wCtr), selJct.hardWidth, 0.1, 0.0) then
            selJct.hardWidth = im.FloatPtr(max(0.0, min(10.0, selJct.hardWidth[0])))

          if im.InputFloat("Central Res Width###" .. tostring(wCtr), selJct.cResWidth, 0.1, 0.0) then
            selJct.cResWidth = im.FloatPtr(max(0.0, min(20.0, selJct.cResWidth[0])))

          if im.InputFloat("Inner Taper Width###" .. tostring(wCtr), selJct.sepWidthI, 0.1, 0.0) then
            selJct.sepWidthI = im.FloatPtr(max(0.0, min(20.0, selJct.sepWidthI[0])))

          if im.InputFloat("Outer Taper Width###" .. tostring(wCtr), selJct.sepWidthO, 0.1, 0.0) then
            selJct.sepWidthO = im.FloatPtr(max(0.0, min(20.0, selJct.sepWidthO[0])))
          im.Columns(2, 'crashBarrierCols1', false)
          if im.Checkbox("Inner Barriers###" .. tostring(wCtr), selJct.isBarriersI) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("Outer Barriers###" .. tostring(wCtr), selJct.isBarriersO) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Traffic Sign Parameters:')
          if im.Checkbox("Include Traffic Signs###" .. tostring(wCtr), selJct.isSigns) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Tread Overlay Parameters:')
          if im.Checkbox("Include Tread Overlays###" .. tostring(wCtr), selJct.isCrossings) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Number Of Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("Taper Section Length###" .. tostring(wCtr), selJct.s2Length, 0.1, 0.0) then
            selJct.s2Length = im.FloatPtr(max(1.0, min(80.0, selJct.s2Length[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(1.0, min(50.0, selJct.capLength[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Hard Shoulder Width###" .. tostring(wCtr), selJct.hardWidth, 0.1, 0.0) then
            selJct.hardWidth = im.FloatPtr(max(0.0, min(10.0, selJct.hardWidth[0])))

          if im.InputFloat("Central Res Width###" .. tostring(wCtr), selJct.cResWidth, 0.1, 0.0) then
            selJct.cResWidth = im.FloatPtr(max(0.0, min(20.0, selJct.cResWidth[0])))

          if im.InputFloat("Inner Taper Width###" .. tostring(wCtr), selJct.sepWidthI, 0.1, 0.0) then
            selJct.sepWidthI = im.FloatPtr(max(0.0, min(20.0, selJct.sepWidthI[0])))

          if im.InputFloat("Outer Taper Width###" .. tostring(wCtr), selJct.sepWidthO, 0.1, 0.0) then
            selJct.sepWidthO = im.FloatPtr(max(0.0, min(20.0, selJct.sepWidthO[0])))
          im.TextColored(cols.greenB, 'Sidewalk Parameters:')
          if im.Checkbox("Include Sidewalks###" .. tostring(wCtr), selJct.isSidewalk) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          if selJct.isSidewalk[0] then
            if im.InputFloat("Sidewalk Width###" .. tostring(wCtr), selJct.sidewalkWidth, 0.1, 2.0) then
              selJct.sidewalkWidth = im.FloatPtr(max(0.5, min(10.0, selJct.sidewalkWidth[0])))

            if im.InputFloat("Sidewalk Height###" .. tostring(wCtr), selJct.sidewalkHeight, 0.01, 0.1) then
              jctMgr.updateJunctionAfterChange(selJctIdx)
          im.Columns(2, 'crashBarrierCols1', false)
          if im.Checkbox("Inner Barriers###" .. tostring(wCtr), selJct.isBarriersI) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("Outer Barriers###" .. tostring(wCtr), selJct.isBarriersO) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Traffic Sign Parameters:')
          if im.Checkbox("Include Traffic Signs###" .. tostring(wCtr), selJct.isSigns) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Tread Overlay Parameters:')
          if im.Checkbox("Include Tread Overlays###" .. tostring(wCtr), selJct.isCrossings) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Number Of Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(0.5, min(20.0, selJct.capLength[0])))
          im.Columns(2, 'crashBarrierCols1', false)
          if im.Checkbox("Inner Barriers###" .. tostring(wCtr), selJct.isBarriersI) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.NextColumn()
          if im.Checkbox("Outer Barriers###" .. tostring(wCtr), selJct.isBarriersO) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Traffic Sign Parameters:')
          if im.Checkbox("Include Traffic Signs###" .. tostring(wCtr), selJct.isSigns) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Number Of Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(1.0, min(50.0, selJct.capLength[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Hard Shoulder Width###" .. tostring(wCtr), selJct.hardWidth, 0.1, 0.0) then
            selJct.hardWidth = im.FloatPtr(max(0.0, min(10.0, selJct.hardWidth[0])))

          if im.Checkbox("Direction###" .. tostring(wCtr), selJct.isY1Outwards) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          im.TextColored(cols.greenB, 'Road Sizing Parameters:')
          if im.InputInt("Number Of Lanes###" .. tostring(wCtr), selJct.numLanesX, 1) then
            selJct.numLanesX = im.IntPtr(max(1, min(6, selJct.numLanesX[0])))

          if im.InputFloat("Taper Section Length###" .. tostring(wCtr), selJct.s2Length, 0.1, 0.0) then
            selJct.s2Length = im.FloatPtr(max(1.0, min(80.0, selJct.s2Length[0])))

          if im.InputFloat("Split Section Length###" .. tostring(wCtr), selJct.s3Length, 0.1, 0.0) then
            selJct.s3Length = im.FloatPtr(max(1.0, min(80.0, selJct.s3Length[0])))

          if im.InputFloat("Exit Roads Length###" .. tostring(wCtr), selJct.capLength, 0.1, 0.0) then
            selJct.capLength = im.FloatPtr(max(1.0, min(50.0, selJct.capLength[0])))

          if im.InputFloat("Lane Width###" .. tostring(wCtr), selJct.laneWidthX, 0.1, 0.0) then
            selJct.laneWidthX = im.FloatPtr(max(1.0, min(20.0, selJct.laneWidthX[0])))

          if im.InputFloat("Hard Shoulder Width###" .. tostring(wCtr), selJct.hardWidth, 0.1, 0.0) then
            selJct.hardWidth = im.FloatPtr(max(0.0, min(10.0, selJct.hardWidth[0])))

          if im.InputFloat("Central Res Width###" .. tostring(wCtr), selJct.cResWidth, 0.1, 0.0) then
            selJct.cResWidth = im.FloatPtr(max(0.0, min(20.0, selJct.cResWidth[0])))

          if im.InputFloat("Inner Taper Width###" .. tostring(wCtr), selJct.sepWidthI, 0.1, 0.0) then
            selJct.sepWidthI = im.FloatPtr(max(0.0, min(20.0, selJct.sepWidthI[0])))

          if im.InputFloat("Outer Taper Width###" .. tostring(wCtr), selJct.sepWidthO, 0.1, 0.0) then
            selJct.sepWidthO = im.FloatPtr(max(0.0, min(20.0, selJct.sepWidthO[0])))
          im.TextColored(cols.greenB, 'Tread Overlay Parameters:')
          if im.Checkbox("Include Tread Overlays###" .. tostring(wCtr), selJct.isCrossings) then
            jctMgr.updateJunctionAfterChange(selJctIdx)
          local flag = i == mfe.selectedPlacedGroupIdx
          if im.Selectable1(tostring(i) .. "###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            mfe.selectedPlacedGroupIdx = max(1, min(#placedGroups, i))
          local flag = i == mfe.selectedPlacedGroupIdx
          if im.Selectable1(tostring(i) .. "###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            mfe.selectedPlacedGroupIdx = max(1, min(#placedGroups, i))
          im.PushItemWidth(150)
          im.InputText("###" .. tostring(wCtr), placedGroup.name, 32)
          im.PopItemWidth()
  if mfe.isNodeEditWinOpen then
    if editor.beginWindow(win.nodeEditWinName, "Node: [" .. tostring(mfe.selectedNodeIdx) .. "]###6611", im.WindowFlags_NoCollapse) then
      local road = roadMgr.roads[mfe.selectedRoadIdx]
                local flag = i == mfe.selectedLaneIdx
                if im.Selectable1('[' .. tostring(i) .. ']', flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                  mfe.selectedLaneIdx = i
                -- 'Set Node Width' input box.
                if im.InputFloat("W###" .. tostring(wCtr), node.widths[i], 0.1, 0.0) then
                  node.widths[i] = im.FloatPtr(max(0.0, min(50.0, node.widths[i][0])))
                -- 'Set Node Left Relative Height' input box.
                if im.InputFloat("H(L)###" .. tostring(wCtr), node.heightsL[i], 0.1, 0.0) then
                  node.heightsL[i] = im.FloatPtr(max(0.0, min(5.0, node.heightsL[i][0])))
                -- 'Set Node Right Relative Height' input box.
                if im.InputFloat("H(R)###" .. tostring(wCtr), node.heightsR[i], 0.1, 0.0) then
                  node.heightsR[i] = im.FloatPtr(max(0.0, min(5.0, node.heightsR[i][0])))
                local flag = i == mfe.selectedLaneIdx
                if im.Selectable1('[' .. tostring(i) .. ']', flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                  mfe.selectedLaneIdx = i
                -- 'Set Node Width' input box.
                if im.InputFloat("W###" .. tostring(wCtr), node.widths[i], 0.1, 0.0) then
                  node.widths[i] = im.FloatPtr(max(0.0, min(50.0, node.widths[i][0])))
                -- 'Set Node Left Relative Height' input box.
                if im.InputFloat("H(L)###" .. tostring(wCtr), node.heightsL[i], 0.1, 0.0) then
                  node.heightsL[i] = im.FloatPtr(max(0.0, min(5.0, node.heightsL[i][0])))
                -- 'Set Node Right Relative Height' input box.
                if im.InputFloat("H(R)###" .. tostring(wCtr), node.heightsR[i], 0.1, 0.0) then
                  node.heightsR[i] = im.FloatPtr(max(0.0, min(5.0, node.heightsR[i][0])))
            local flag = i == mfe.selectedProfileIdx
            if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
              mfe.selectedProfileIdx = i
            im.PushItemWidth(200)
            if im.InputText("###" .. tostring(wCtr), profile.name, 32) then
              mfe.selectedProfileIdx = i
    local numLanes = numLeft + numRight
    if editor.beginWindow(win.profileEditWinName, "Template Editor - [" .. tostring(ffi.string(profile.name)) .. "]###1113", im.WindowFlags_NoCollapse) then
      local wCtr = 1
              local flag = i == mfe.selectedLaneIdx
              if im.Selectable1(tostring(i), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                mfe.selectedLaneIdx = i
              im.PushItemWidth(-30)
              im.InputFloat("W###" .. tostring(wCtr), lane.width, 0.1, 0.0)
              wCtr = wCtr + 1
              im.PushItemWidth(-30)
              im.InputFloat("H(L)###" .. tostring(wCtr), lane.heightL, 0.01, 0.0)
              wCtr = wCtr + 1
              im.PushItemWidth(-30)
              im.InputFloat("H(R)###" .. tostring(wCtr), lane.heightR, 0.01, 0.0)
              wCtr = wCtr + 1
              local flag = i == mfe.selectedLaneIdx
              if im.Selectable1(tostring(i), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                mfe.selectedLaneIdx = i
              im.PushItemWidth(-30)
              im.InputFloat("W###" .. tostring(wCtr), lane.width, 0.1, 0.0)
              wCtr = wCtr + 1
              im.PushItemWidth(-30)
              im.InputFloat("H(L)###" .. tostring(wCtr), lane.heightL, 0.01, 0.0)
              wCtr = wCtr + 1
              im.PushItemWidth(-30)
              im.InputFloat("H(R)###" .. tostring(wCtr), lane.heightR, 0.01, 0.0)
              wCtr = wCtr + 1
@/lua/ge/extensions/career/modules/branches/landing.lua
      local new_number = number + addedValue
      local oValue = color:gsub("(%d+)", tostring(new_number))
      return oValue
@/lua/common/libs/copas/copas/lock.lua
  if timeout < 0 then
    error("expected timeout (1st argument) to be a number greater than or equal to 0, got: " .. tostring(seconds), 2)
  end
@/lua/common/extensions/tech/techCapture.lua

local LUA_CONTEXT = obj == nil and 'GE' or tostring(obj:getID())
local tcomCaptureName = nil
  local json = jsonEncode(requestData)
  tcomRequestFile:write(tostring(clock), '\n', LUA_CONTEXT, '\n', json, '\n')
  local json = jsonEncode(response)
  tcomResponseFile:write(tostring(clock), '\n', LUA_CONTEXT, '\n', json, '\n')
  if _flushInterval == nil then return end
  if error then
    log('E', logTag, 'Error in response [' .. tostring(message._id) .. ']: ' .. error)
  elseif self._callback then
@/lua/vehicle/extensions/scenario/shiftBooster.lua
    for _, node in pairs(v.data.nodes) do
        print("node = " .. tostring(node.cid) .. ' > ' .. tostring(forceVec))
        obj:applyForceVector(node.cid, forceVec)
    for _, node in pairs(v.data.nodes) do
        print("node = " .. tostring(node.cid) .. ' > ' .. tostring(forceVec))
        obj:applyForceVector(node.cid, forceVec)
    ]]
  print("applyBoost > " .. tostring(forceVec))
  obj:setWind(forceVec.x, forceVec.y, forceVec.z)
@/lua/ge/extensions/flowgraph/nodes/string/stringconcat.lua
      if self.pinIn[pin.name].value ~= nil and self.pinIn[pin.name].value ~= false then
        local newValue = tostring(self.pinIn[pin.name].value)
        -- skip over nil pins, as they don't introduce any new characters to the output concat string, AND they will stop table iteration
          i = i + 1
          dirty = dirty or (tostring(self.inputCache[i]) ~= newValue)
          self.inputCache[i] = newValue
@/lua/ge/extensions/tech/capturePlayer.lua
  if responsesDir == nil then responsesDir = '/' end
  return responsesDir .. filename .. '_' .. name .. '_' .. tostring(id)
end
        if remainingWait > 0 then
          log('D', logTag, 'Sleeping for ' .. tostring(remainingWait) .. 's.')
          job.sleep(remainingWait)
  if state ~= TIMESTAMP then
    log('W', logTag, 'Incomplete capture detected, expected state ' .. tostring(state))
  end

  local depthFloat = ffi.new('float[' .. tostring(points) .. ']')
  ffi.copy(depthFloat, sensorData, bytes)
  if points ~= math.floor(points) then
    log('E', logTag, 'Number of points ' .. tostring(points) .. ' is not an integer!')
    return nil
  end
  local sizeStr = '[' .. tostring(points) .. ']'
  local returnsFloat = ffi.new('struct radar_return_t' .. sizeStr)
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/trackRecovery.lua

  -- print('flip: '     .. tostring(self.pinIn.flip.value))
  -- print('recovery: ' .. tostring(self.pinIn.recovery.value))
  -- print('flip: '     .. tostring(self.pinIn.flip.value))
  -- print('recovery: ' .. tostring(self.pinIn.recovery.value))
  -- print('restart: '  .. tostring(self.pinIn.restart.value))
  -- print('recovery: ' .. tostring(self.pinIn.recovery.value))
  -- print('restart: '  .. tostring(self.pinIn.restart.value))

  -- print('recoveryType: '..tostring(recoveryType))
@/lua/ge/extensions/core/loadMapCmd.lua
  end
  log("I", "changeMap", "starting in ="..tostring(args.mapName))
  freeroam_freeroam.startFreeroam(args.mapName)
  if not data then return end
  -- log("I", "set", "map ="..tostring(mname).."   a="..dumps(a))
  -- log("I", "set", "startCmd ="..tostring(startCmd).." ignoreStartupCmd="..dumps(ignoreStartupCmd))
  -- log("I", "set", "map ="..tostring(mname).."   a="..dumps(a))
  -- log("I", "set", "startCmd ="..tostring(startCmd).." ignoreStartupCmd="..dumps(ignoreStartupCmd))
  if startCmd and ignoreStartupCmd then
@/lua/ge/extensions/editor/flowgraphEditor.lua
  if focus then
    --print("Focus: " .. tostring(focus))
    if not pushedActionMap then
  local del = nil
  im.Text(tostring(tableSize(sortedNames)) .. " Custom Lua Nodes:")
  for _, name in ipairs(sortedNames) do
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/scenarioTiles.lua
  if scenario.difficulty or scenario.difficultyLabel then
    local difficultyValue = scenario.difficultyLabel or tostring(scenario.difficulty)
    table.insert(specifications, {
@/lua/ge/extensions/editor/vizHelper.lua
      im.Separator()
      im.Text("object: " .. tostring(mouseHit.object:getId() .. ' in ' .. string.format('%0.2f', mouseHit.distance) .. 'm'))
    im.Separator()
    im.Text(tostring(#savedDecals) .. " decals saved")
    im.SameLine()
@/lua/common/libs/timerwheel/timerwheel.lua
local default_err_handler = function(err)
  io.stderr:write(debug.traceback("TimerWheel callback failed with: " .. tostring(err)))
end
@/lua/common/jbeam/tableSchema.lua
      if not data then
        log('E', '', 'unable to read CSV file: ' .. tostring(rowValue.include))
        return
        if ctx.header[i] ~= data[1][i] then
          log('E', '', 'CSV file has mismatching header column ' .. tostring(i) .. '. Required: ' .. dumps(ctx.header) .. ' - present in file: ' .. dumps(data[1]))
          return
      end
      --log('I', '', 'Successfully read ' .. tostring(ctx.rowCounter - startRowCounter) .. ' rows from file ' .. tostring(rowValue.include))
      rowValue.include = nil
      end
      --log('I', '', 'Successfully read ' .. tostring(ctx.rowCounter - startRowCounter) .. ' rows from file ' .. tostring(rowValue.include))
      rowValue.include = nil
    local rowValueSize = #rowValue
    --log('D', "" *** "..tostring(ctx.rowCounter).." = "..tostring(rowValue).." ["..type(rowValue).."]")
    local rowValueSize = #rowValue
    --log('D', "" *** "..tostring(ctx.rowCounter).." = "..tostring(rowValue).." ["..type(rowValue).."]")
      for rk,rv in ipairs(rowValue) do
        --log('D', "jbeam.", "### "..header[rk].."//"..tostring(newRow[header[rk]]))
        -- if there is a local option named like a row key, use the option instead
          log('E', "", "*** unable to parse row, header for entry is missing: ")
          log('E', "", "*** header: "..dumps(ctx.header) .. ' missing key: ' .. tostring(rk) .. ' -- is the section header too short?')
          log('E', "", "*** row: "..dumps(rowValue))
    if type(entry) == "table" and tableIsDict(entry) then
      log('D', ""," ** "..tostring(keyEntry).." = [DICT] #" ..tableSize(entry))
    elseif type(entry) == "table" and not tableIsDict(entry) then
    elseif type(entry) == "table" and not tableIsDict(entry) then
      log('D', ""," ** "..tostring(keyEntry).." = [LIST] #"..tableSize(entry))
    else
    else
      log('D', ""," ** "..tostring(keyEntry).." = "..tostring(entry).." ["..type(entry).."]")
    end
    else
      log('D', ""," ** "..tostring(keyEntry).." = "..tostring(entry).." ["..type(entry).."]")
    end
    vehicle.maxIDs[keyEntry] = 0
    --log('D', ""," ** creating max val "..tostring(keyEntry).." = "..tostring(vehicle.maxIDs[keyEntry]))
    -- then walk the tables
    vehicle.maxIDs[keyEntry] = 0
    --log('D', ""," ** creating max val "..tostring(keyEntry).." = "..tostring(vehicle.maxIDs[keyEntry]))
    -- then walk the tables
            vehicle[keyEntry] = newList
            --log('D', ""," - "..tostring(newListSize).." "..tostring(keyEntry))
          end
            vehicle[keyEntry] = newList
            --log('D', ""," - "..tostring(newListSize).." "..tostring(keyEntry))
          end
@/lua/ge/extensions/editor/roadSpline.lua
          local flag = i == selectedGroupIdx
          if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            selectedGroupIdx = i
          else
            if im.InputText("###" .. tostring(wCtr), splineNamePtr, 32) then
              group.name = ffi.string(splineNamePtr)
                  local flag = (layer.id == selectedLayerId)
                  if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                    selectedLayerId = layer.id
                  else
                    if im.InputText("###" .. tostring(wCtr), layerNamePtr, 32) then
                      local preState = groupMgr.deepCopyGroup(selGroup)
@/lua/ge/extensions/editor/masterSpline.lua
          local flag = i == selectedSplineIdx
          if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
            selectedSplineIdx = i
          if spline.isEnabled then
            if im.InputText("###" .. tostring(wCtr), splineNamePtr, 32) then
              local preState = splineMgr.deepCopyMasterSpline(spline)
                  local flag = i == selectedLayerIdx
                  if im.Selectable1("###" .. tostring(wCtr), flag, bit.bor(im.SelectableFlags_SpanAllColumns, im.SelectableFlags_AllowItemOverlap)) then
                    selectedLayerIdx = i
                  local layerNamePtr = im.ArrayChar(32, layer.name)
                  if im.InputText("###" .. tostring(wCtr), layerNamePtr, 32) then
                    local preState = splineMgr.deepCopyMasterSpline(selSpline)
                  if layer.linkedSplineId and layer.linkType then
                    if editor.uiIconImageButton(icons.cameraFocusTopDown, iconsSmall, cols.blueB, nil, nil, 'goToLayerBtn' .. tostring(i)) then
                      -- Navigate to the linked spline's tool.
@/lua/ge/extensions/editor/flowgraph/projectSettings.lua
  im.NextColumn()
  local textinput = im.ArrayChar(512, tostring(self.mgr.description or ''))
  local editEnded = im.BoolPtr(false)
  im.NextColumn()
  im.Text(tostring(self.mgr.savedFilename))
  im.NextColumn()
  im.NextColumn()
  im.Text(tostring(self.mgr.savedDir))
  im.NextColumn()
@/lua/ge/extensions/tech/pythonExport.lua
    end
    return tostring(value)
  end
  end
  return tostring(value)
end
@/lua/vehicle/extensions/performanceLogger.lua
    minimums[name] = math.min(minimums[name] or 9999, result)
    local display = tostring(showMin and minimums[name] or result)
    log("I", "performanceLogger.measureAverage", string.format("%s: %.5f ms (avg over %i measurements)", name, display, stopCount))
@/lua/ge/extensions/render/renderViews.lua
  if not renderView:saveToDisk(filename) then
    log('E', '', 'failed to save to disk: ' .. tostring(filename))
  end
@/lua/ge/extensions/flowgraph/nodes/ui/monologue.lua
          self.current = i
          ui_message(tostring(self.pinIn['message_'..i].value), self.pinIn['duration_'..i].value, self.pinIn.category.value or "", self.pinIn.icon.value)
        end
@/lua/ge/extensions/gameplay/rally/tools/devTools.lua
    if missionId then
      im.Text("Current Mission: " .. tostring(missionId))
@/lua/ge/extensions/core/vehiclePaints.lua
  local model = obj and obj.jbeam
  local config = obj and tostring(obj.partConfig)
  config  = string.match(config, "vehicles/".. model .."/(.*).pc")
@/lua/vehicle/extensions/gameplayStatistic.lua
local function metricAdd(name,value,aggregate)
  obj:queueGameEngineLua("gameplay_statistic.metricAdd("..dumps(name)..","..tostring(value)..","..tostring(aggregate)..")")
end
local function metricAdd(name,value,aggregate)
  obj:queueGameEngineLua("gameplay_statistic.metricAdd("..dumps(name)..","..tostring(value)..","..tostring(aggregate)..")")
end
local function metricSet(name,value,aggregate)
  obj:queueGameEngineLua("gameplay_statistic.metricSet("..dumps(name)..","..tostring(value)..","..tostring(aggregate)..")")
end
local function metricSet(name,value,aggregate)
  obj:queueGameEngineLua("gameplay_statistic.metricSet("..dumps(name)..","..tostring(value)..","..tostring(aggregate)..")")
end
@/lua/ge/extensions/core/checkpoints.lua
local function completeReset(vehicleId, vehicleName)
  log('I', logTag,'completeReset called for vid: '..tostring(vehicleId) .. " vehName: "..tostring(vehicleName))
  local aiVehiclePath = M.state.aiVehiclePath
local function completeReset(vehicleId, vehicleName)
  log('I', logTag,'completeReset called for vid: '..tostring(vehicleId) .. " vehName: "..tostring(vehicleName))
  local aiVehiclePath = M.state.aiVehiclePath
  local rot = quatFromDir(-dirVec, upVec)
  -- log('I', logTag, 'dirVec: '..tostring(dirVec))
  -- log('I', logTag, 'upVec: '..tostring(upVec))
  -- log('I', logTag, 'dirVec: '..tostring(dirVec))
  -- log('I', logTag, 'upVec: '..tostring(upVec))
  -- log('I', logTag, 'rot: '..tostring(rot.x) ..', '..tostring(rot.y)..', '..tostring(rot.z)..', '..tostring(rot.w))
  -- log('I', logTag, 'upVec: '..tostring(upVec))
  -- log('I', logTag, 'rot: '..tostring(rot.x) ..', '..tostring(rot.y)..', '..tostring(rot.z)..', '..tostring(rot.w))
  -- log('I', logTag, 'upVec: '..tostring(upVec))
  -- log('I', logTag, 'rot: '..tostring(rot.x) ..', '..tostring(rot.y)..', '..tostring(rot.z)..', '..tostring(rot.w))
  -- log('I', logTag, 'upVec: '..tostring(upVec))
  -- log('I', logTag, 'rot: '..tostring(rot.x) ..', '..tostring(rot.y)..', '..tostring(rot.z)..', '..tostring(rot.w))
  -- log('I', logTag, 'upVec: '..tostring(upVec))
  -- log('I', logTag, 'rot: '..tostring(rot.x) ..', '..tostring(rot.y)..', '..tostring(rot.z)..', '..tostring(rot.w))
  -- local vehicle = getObjectByID(vehId)
  -- local msg = 'onVehicleSpawned called... vehId: '..tostring(vehId)
  -- if vehicle then
  --   local vehName = vehicle:getField('name', '')
  --   msg = msg .. ' name: '..tostring(vehName)
  --   if vehicle.playerUsable then
  --     msg = msg .. ' playerUsable: '..tostring(vehicle.playerUsable)
  --   end
  -- local vehicle = getObjectByID(vid)
  -- local msg = 'onVehicleDestroyed called... vid: '..tostring(vid)
  -- if vehicle then
  --   local vehName = vehicle:getField('name', '')
  --   msg = msg .. ' name: '..tostring(vehName)
  --   if vehicle.playerUsable then
  --     msg = msg .. ' playerUsable: '..tostring(vehicle.playerUsable)
  --   end
@/lua/vehicle/extensions/api.lua

    --print('body:' .. tostring(body))
    --print('code:' .. tostring(code))
    --print('body:' .. tostring(body))
    --print('code:' .. tostring(code))
    --print('headers:' .. dumps(headers))
    --print('headers:' .. dumps(headers))
    --print('status:' .. tostring(status))
    return jsonDecode(table.concat(respbody), 'json request response')
@/lua/vehicle/extensions/tech/ACC.lua
    if printDebugLogs then
        log("I", "", "targetSpeed: " .. tostring(targetSpeedVal)
            .. ", currentSpeed: " .. tostring(currentSpeed)
        log("I", "", "targetSpeed: " .. tostring(targetSpeedVal)
            .. ", currentSpeed: " .. tostring(currentSpeed)
            .. ", targetThrottle: " .. tostring(targetThrottle)
            .. ", currentSpeed: " .. tostring(currentSpeed)
            .. ", targetThrottle: " .. tostring(targetThrottle)
            .. ", smoothedThrottle: " .. tostring(throttleValue))
            .. ", targetThrottle: " .. tostring(targetThrottle)
            .. ", smoothedThrottle: " .. tostring(throttleValue))
    end

    -- log("I", "", "Distance to Lead Car: " .. tostring(distanceToLeadCar))
    -- log("I", "", "velocityTest: " .. tostring(velocityy))
    -- log("I", "", "Distance to Lead Car: " .. tostring(distanceToLeadCar))
    -- log("I", "", "velocityTest: " .. tostring(velocityy))
    -- log("I", "", "targetSpeed: " .. tostring(targetSpeedIn))
    -- log("I", "", "velocityTest: " .. tostring(velocityy))
    -- log("I", "", "targetSpeed: " .. tostring(targetSpeedIn))
    -- if velocityy < 12.0 then
    --     -- log("I", "", "Distance to leadCar: " .. tostring(distanceToLeadCar))
    --     u = (-1 / (distanceToLeadCar / 5))
    --         u = 0
    --         -- log("I", "", "Velocity is below threshold: " .. tostring(velocityy))
    --     end
    --     end
    --     -- log("I", "", "Velocity under limit: " .. tostring(u))
    -- end
        if printDebugLogs then
            log('I', '', tostring(currentSpeed))
        end
@/lua/common/jsonPrettyEncoderCustom.lua
    local s = keys[i]
    table.insert(weighted_vector, {s = s, w = weights[tostring(s):lower()] or 50})  -- 50 = middle if no weight is defined
  end
      else
        return tostring(a.s) < tostring(b.s)
      end
      else
        return tostring(a.s) < tostring(b.s)
      end
  end
  if vtype == 'boolean' then return tostring(v) end
      for i = 1, #v do
        table.insert(tmp, encode(v[i], lvl + 1, numberPrecision, tableWeights, foldingCallback, _levelPath .. '/' .. tostring(i)))
      end
          local vv = v[kk]
          local cv = encode(vv, lvl + 1, numberPrecision, tableWeights, foldingCallback, _levelPath .. '/' .. tostring(kk))
          if cv ~= nil then table.insert(tmp, string.format('"%s":%s', jsonEscapeString(tostring(kk)), cv)) end
          local cv = encode(vv, lvl + 1, numberPrecision, tableWeights, foldingCallback, _levelPath .. '/' .. tostring(kk))
          if cv ~= nil then table.insert(tmp, string.format('"%s":%s', jsonEscapeString(tostring(kk)), cv)) end
        end
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/rallyMoveVehicleTo.lua
    if not veh then
      log('W', logTag, 'Vehicle not found: ' .. tostring(self.pinIn.vehId.value))
      return
@/lua/ge/extensions/gameplay/rally/rallyManager.lua
  profilerPushEvent("rallyManager:triggerPacenote")
  if gameplay_rally and gameplay_rally.getDebugLogging() then log('D', logTag, 'triggerPacenote name='..tostring(pacenote.name)) end
  if self:_playbackAllowed(pacenote) then
  -- self.drivelineMode = self.drivelineMode or ms:getDrivelineMode()
  -- if gameplay_rally and gameplay_rally.getDebugLogging() then log('D', logTag, 'drivelineMode=' .. tostring(RallyEnums.drivelineModeNames[self.drivelineMode])) end
function C:enqueuePacenote(pacenote)
  if gameplay_rally and gameplay_rally.getDebugLogging() then log('D', logTag, 'enqueuePacenote name='..tostring(pacenote.name)) end
  self.pacenoteQueue:push_right(pacenote)
  if peekValue == holdValue then
    -- log('D', logTag, 'processPacenoteQueue: '..tostring(peekValue)) -- spams the log
    -- do nothing
      if gameplay_rally and gameplay_rally.getDebugLogging() then
        log('D', logTag, string.format('processPacenoteQueue: got pacenote name=%s', tostring(qPacenote.name)))
      end
    if gameplay_rally and gameplay_rally.getDebugLogging() then
      log('E', logTag, string.format('processPacenoteQueue: unknown peek value: %s', tostring(peekValue)))
    end

    -- log('D', logTag, string.format('enqueueRandomSystemPacenote: %s - raw audioLen value: %s (type: %s)', basename, tostring(metadataVal.audioLen), type(metadataVal.audioLen)))
    if not audioLen then
      log('E', logTag, string.format('enqueueRandomSystemPacenote: invalid audioLen for %s: %s (type: %s)', basename, tostring(metadataVal.audioLen), type(metadataVal.audioLen)))
      return
@/lua/common/libs/copas/copas/http.lua
    socket.try(nreqt.host and nreqt.host ~= "",
        "invalid host '" .. base.tostring(nreqt.host) .. "'")
    -- compute uri if user hasn't overriden
@/lua/ge/screenshot.lua
  if OnlineServiceProvider and OnlineServiceProvider.isWorking and OnlineServiceProvider.accountID ~= "" then
    res.steamIDHash = tostring(hashStringSHA1(OnlineServiceProvider.accountID))
    res.steamPlayerName = OnlineServiceProvider.playerName
    filepath = ''
    local screenPath = screenshotPath .. tostring(getScreenShotFolderString())
    if not FS:directoryExists(screenPath) then
    repeat
      filename_without_ext = 'screenshot_' .. tostring(getScreenShotDateTimeString())
      if counter > 0 then
      if counter > 0 then
        filename_without_ext = filename_without_ext .. '_' .. tostring(counter)
      end

  -- log('I','screenshot', "Taking screenshot "..fullFilename.." Format = "..screenshotFormat.." superSampling = "..tostring(superSampling).." tiles = "..tostring(tiles).." overlap = "..tostring(overlap).." downsample = "..tostring(downsample))
  createScreenshot(fullFilename, screenshotFormat, superSampling, tiles, overlap, downsample)

  -- log('I','screenshot', "Taking screenshot "..fullFilename.." Format = "..screenshotFormat.." superSampling = "..tostring(superSampling).." tiles = "..tostring(tiles).." overlap = "..tostring(overlap).." downsample = "..tostring(downsample))
  createScreenshot(fullFilename, screenshotFormat, superSampling, tiles, overlap, downsample)

  -- log('I','screenshot', "Taking screenshot "..fullFilename.." Format = "..screenshotFormat.." superSampling = "..tostring(superSampling).." tiles = "..tostring(tiles).." overlap = "..tostring(overlap).." downsample = "..tostring(downsample))
  createScreenshot(fullFilename, screenshotFormat, superSampling, tiles, overlap, downsample)

  -- log('I','screenshot', "Taking screenshot "..fullFilename.." Format = "..screenshotFormat.." superSampling = "..tostring(superSampling).." tiles = "..tostring(tiles).." overlap = "..tostring(overlap).." downsample = "..tostring(downsample))
  createScreenshot(fullFilename, screenshotFormat, superSampling, tiles, overlap, downsample)
@/lua/ge/extensions/editor/veMain.lua
local function onEditorHeadlessChange(enabled, toolName)
  log('I', 'veMain', 'onEditorHeadlessChange(' .. tostring(enabled) .. ', "' .. tostring(toolName) .. '")')
local function onEditorHeadlessChange(enabled, toolName)
  log('I', 'veMain', 'onEditorHeadlessChange(' .. tostring(enabled) .. ', "' .. tostring(toolName) .. '")')
@/lua/ge/extensions/flowgraph/nodes/vehicle/customPartsConfigProvider.lua
  builder:Middle()
  im.Text(tostring(self.modelName))
  im.Text(#self.sortedKeys.parts .. " Parts, " ..#self.sortedKeys.vars .. " Vars")
@/lua/ge/extensions/core/settings/audio.lua
  if not providerOK then
    log( 'E', 'settings.audio', 'incorrect audio provider: "' .. tostring(audioProviderName) .. '": ' .. dumps(devices) )
      TorqueScriptLua.setVar( '$pref::SFX::providerName', audioProviderName )
      log( 'W', 'settings.audio', 'set provider to ' .. tostring(audioProviderName))
    end
  local useHardware = Engine.Audio.getCanUseHardware()
  if TorqueScript.eval( 'sfxCreateDevice($pref::SFX::providerName, '..tostring(useHardware)..', -1);' ) == '0' then
    audioProviderName = TorqueScriptLua.getVar( '$pref::SFX::providerName' )
local function createAudioDevice(providerName, deviceName)
  log( 'I', 'audio', 'createAudioDevice: provider = '..tostring(providerName)..'  device = '..tostring(deviceName) )
  -- validate options
local function createAudioDevice(providerName, deviceName)
  log( 'I', 'audio', 'createAudioDevice: provider = '..tostring(providerName)..'  device = '..tostring(deviceName) )
  -- validate options
  if not provider then
    log('E', 'audio', 'incorrect audio provider: "' .. tostring(providerName) .. '": ' .. dumps(providers))
      TorqueScriptLua.setVar('$pref::SFX::providerName', providerName)
      log( 'W', 'audio', 'set provider to ' .. tostring(providerName))
    end
  else
    log( 'E', 'createAudioProviderDevice', 'Unable to create SFX device: '..audioProviderName..' '..tostring(useHardware));
  end
  dump(providers)
  log('I', '','     swapping to device index '..tostring(index))
  local fmodDevices = providers['FMOD']
@/lua/ge/extensions/editor/api/object.lua
  local obj = Sim.findObjectById(objectId)
  if arrayIndex and arrayIndex >= 0 then arrayIndex = tostring(arrayIndex) elseif not arrayIndex then arrayIndex = "" end
  if obj then
    obj:preApply()
    obj:setField(fieldName, tostring(arrayIndex), value)
    obj:setEditorDirty(true)
      table.insert(newSelection, obj:getId())
      editor.logDebug("Selected by type: ".. objName .. " id: " .. tostring(obj:getId()))
    end
        objPos:setAxis(axis, objPos:getAxis(axis) + delta)
        local newPosStr = tostring(objPos.x) .. " " .. tostring(objPos.y) .. " " .. tostring(objPos.z)
        editor.setFieldValue(object:getID(), "position", newPosStr)
        objPos:setAxis(axis, objPos:getAxis(axis) + delta)
        local newPosStr = tostring(objPos.x) .. " " .. tostring(objPos.y) .. " " .. tostring(objPos.z)
        editor.setFieldValue(object:getID(), "position", newPosStr)
        objPos:setAxis(axis, objPos:getAxis(axis) + delta)
        local newPosStr = tostring(objPos.x) .. " " .. tostring(objPos.y) .. " " .. tostring(objPos.z)
        editor.setFieldValue(object:getID(), "position", newPosStr)
      objPos:setAxis(axis, pos:getAxis(axis))
      local newPosStr = tostring(objPos.x) .. " " .. tostring(objPos.y) .. " " .. tostring(objPos.z)
      editor.setFieldValue(object:getID(), "position", newPosStr)
      objPos:setAxis(axis, pos:getAxis(axis))
      local newPosStr = tostring(objPos.x) .. " " .. tostring(objPos.y) .. " " .. tostring(objPos.z)
      editor.setFieldValue(object:getID(), "position", newPosStr)
      objPos:setAxis(axis, pos:getAxis(axis))
      local newPosStr = tostring(objPos.x) .. " " .. tostring(objPos.y) .. " " .. tostring(objPos.z)
      editor.setFieldValue(object:getID(), "position", newPosStr)
      pos = pos + deltaTranslate
      editor.setFieldValue(object:getId(), "position", tostring(pos.x) .. " " .. tostring(pos.y) .. " " .. tostring(pos.z))
    end
      pos = pos + deltaTranslate
      editor.setFieldValue(object:getId(), "position", tostring(pos.x) .. " " .. tostring(pos.y) .. " " .. tostring(pos.z))
    end
      pos = pos + deltaTranslate
      editor.setFieldValue(object:getId(), "position", tostring(pos.x) .. " " .. tostring(pos.y) .. " " .. tostring(pos.z))
    end
  local group = SimGroup()
  group:setField("groupPosition", "", tostring(centroid.x) .. " " .. tostring(centroid.y) .. " " .. tostring(centroid.z))
  local group = SimGroup()
  group:setField("groupPosition", "", tostring(centroid.x) .. " " .. tostring(centroid.y) .. " " .. tostring(centroid.z))
  local group = SimGroup()
  group:setField("groupPosition", "", tostring(centroid.x) .. " " .. tostring(centroid.y) .. " " .. tostring(centroid.z))
  for i,v in ipairs(prefabInstanceList) do
    log('I','','  '..tostring(v:getName())..' or '..tostring(v:getInternalName()))
  end
  for i,v in ipairs(prefabInstanceList) do
    log('I','','  '..tostring(v:getName())..' or '..tostring(v:getInternalName()))
  end
@/lua/ge/extensions/flowgraph/nodes/types/number.lua
  builder:Middle()
  im.Text(tostring(self.data.value))
end
@/lua/ge/extensions/editor/flowgraph/garbageDebug.lua
  im.PushFont2(1)
  local valueText = tostring(entry.value) .. " " .. self.valueUnit
  local valueTextSize = im.CalcTextSize(valueText)
@/lua/ge/extensions/core/trailerRespawn.lua
  if trailerReg[vehId] then
    log("D", logTag, "Unregistered vehicle "..tostring(vehId).."; trailer was ".. (type(trailerReg[vehId]) == "table" and tostring(trailerReg[vehId].trailerId) or trailerReg[vehId]))
    trailerReg[vehId] = nil
  if trailerReg[vehId] then
    log("D", logTag, "Unregistered vehicle "..tostring(vehId).."; trailer was ".. (type(trailerReg[vehId]) == "table" and tostring(trailerReg[vehId].trailerId) or trailerReg[vehId]))
    trailerReg[vehId] = nil
    if coupleInfo and coupleInfo.trailerId == vehId then
      log("D", logTag, "Unregistered trailer "..tostring(vehId).."; vehicle was "..tostring(vId))
      trailerReg[vId] = nil
    if coupleInfo and coupleInfo.trailerId == vehId then
      log("D", logTag, "Unregistered trailer "..tostring(vehId).."; vehicle was "..tostring(vId))
      trailerReg[vId] = nil
  if getAttachedNonTrailer(objId1) and not checkRedundancy(objId2, objId1) then
    log("D", logTag, tostring(objId1).." registered trailer "..tostring(objId2).."  node = "..tostring(nodeId).."  trailernode = "..tostring(obj2nodeId))
    trailerReg[objId1] = {trailerId=objId2, trailerNode=obj2nodeId, node=nodeId}
  if getAttachedNonTrailer(objId1) and not checkRedundancy(objId2, objId1) then
    log("D", logTag, tostring(objId1).." registered trailer "..tostring(objId2).."  node = "..tostring(nodeId).."  trailernode = "..tostring(obj2nodeId))
    trailerReg[objId1] = {trailerId=objId2, trailerNode=obj2nodeId, node=nodeId}
  if getAttachedNonTrailer(objId1) and not checkRedundancy(objId2, objId1) then
    log("D", logTag, tostring(objId1).." registered trailer "..tostring(objId2).."  node = "..tostring(nodeId).."  trailernode = "..tostring(obj2nodeId))
    trailerReg[objId1] = {trailerId=objId2, trailerNode=obj2nodeId, node=nodeId}
  if getAttachedNonTrailer(objId1) and not checkRedundancy(objId2, objId1) then
    log("D", logTag, tostring(objId1).." registered trailer "..tostring(objId2).."  node = "..tostring(nodeId).."  trailernode = "..tostring(obj2nodeId))
    trailerReg[objId1] = {trailerId=objId2, trailerNode=obj2nodeId, node=nodeId}
  else
    log("D", logTag, tostring(objId2).." registered trailer "..tostring(objId1).."  node = "..tostring(obj2nodeId).."  trailernode = "..tostring(nodeId))
    if checkRedundancy(objId1,objId2) then
  else
    log("D", logTag, tostring(objId2).." registered trailer "..tostring(objId1).."  node = "..tostring(obj2nodeId).."  trailernode = "..tostring(nodeId))
    if checkRedundancy(objId1,objId2) then
  else
    log("D", logTag, tostring(objId2).." registered trailer "..tostring(objId1).."  node = "..tostring(obj2nodeId).."  trailernode = "..tostring(nodeId))
    if checkRedundancy(objId1,objId2) then
  else
    log("D", logTag, tostring(objId2).." registered trailer "..tostring(objId1).."  node = "..tostring(obj2nodeId).."  trailernode = "..tostring(nodeId))
    if checkRedundancy(objId1,objId2) then
    getObjectByID(trailerReg[vehId].trailerId):setActive(active and 1 or 0)
    log("D", logTag, "Trailer "..tostring(trailerReg[vehId].trailerId).." active state set to "..tostring(active))
    getObjectByID(trailerReg[vehId].trailerId):setActive(active and 1 or 0)
    log("D", logTag, "Trailer "..tostring(trailerReg[vehId].trailerId).." active state set to "..tostring(active))
        debugDrawer:drawSphere( (pos+cpos), 0.05, ColorF(1, 0, 0, 1))
        debugDrawer:drawTextAdvanced( (pos+cpos), String(tostring(vID.."@"..ci)), ColorF(0.2, 0, 0, 1), true, false, ColorI(255,255,255,255) )
      end
@/lua/ge/extensions/scenario/raceDebug.lua
        debugDrawer:drawSphere(pp, n.radius, ColorF(1,0,0,0.3))
        --debugDrawer:drawText(pp, String("#" .. tostring(i) .. "/" .. #currentScenario.lapConfig ), ColorF(0,0,0,1))
        local label = "wp " .. tostring(i) .. "/" .. #currentScenario.lapConfig
        --debugDrawer:drawText(pp, String("#" .. tostring(i) .. "/" .. #currentScenario.lapConfig ), ColorF(0,0,0,1))
        local label = "wp " .. tostring(i) .. "/" .. #currentScenario.lapConfig
        debugDrawer:drawText(pp, String(label), ColorF(0,0,0,1),false)
      if lastwpd then
        --print(" route: " .. tostring(lastwpdStr) .. " -> " .. tostring(wp))
        local col = ColorF(0,1,0,0.6)
      if lastwpd then
        --print(" route: " .. tostring(lastwpdStr) .. " -> " .. tostring(wp))
        local col = ColorF(0,1,0,0.6)
@/lua/ge/extensions/gameplay/drift/saveLoad.lua
  if not json then
    log('E', logTag, 'unable to find driftData file: ' .. tostring(fileName))
    return
@/lua/ge/extensions/util/terrainGenerator.lua
  if not self.heightMap or (string.find(self.heightMap, '/') and not FS:fileExists(self.heightMap)) then
    log('E', logTag, 'Heightmap file not found: '..tostring(self.heightMap))
    return
@/lua/ge/extensions/scenario/scenarios.lua
      if bo then
        bo:queueLuaCommand('controller.setFreeze('..tostring(state) ..')')
      end

  log('D', logTag, 'changeState: ' .. tostring(newState))
local function endRace(countDownTime)
  -- log('D', logTag, 'endRace called...'..tostring(countDownTime))
  if not scenario then return end
      for field, value in pairs(objFields) do
        --log('D', logTag, 'setting [' .. tostring(objName)..'] field:'..tostring(field)..' value:'..tostring(value))
        levelObj:setField(field, "", tostring(value))
      for field, value in pairs(objFields) do
        --log('D', logTag, 'setting [' .. tostring(objName)..'] field:'..tostring(field)..' value:'..tostring(value))
        levelObj:setField(field, "", tostring(value))
      for field, value in pairs(objFields) do
        --log('D', logTag, 'setting [' .. tostring(objName)..'] field:'..tostring(field)..' value:'..tostring(value))
        levelObj:setField(field, "", tostring(value))
        --log('D', logTag, 'setting [' .. tostring(objName)..'] field:'..tostring(field)..' value:'..tostring(value))
        levelObj:setField(field, "", tostring(value))
      end
      for field, value in pairs(objFields) do
        --log('D', logTag, 'setting [' .. tostring(objName)..'] field:'..tostring(field)..' value:'..tostring(value))
        initialLevelState[objName][field] = levelObj:getField(field, "0")
      for field, value in pairs(objFields) do
        --log('D', logTag, 'setting [' .. tostring(objName)..'] field:'..tostring(field)..' value:'..tostring(value))
        initialLevelState[objName][field] = levelObj:getField(field, "0")
      for field, value in pairs(objFields) do
        --log('D', logTag, 'setting [' .. tostring(objName)..'] field:'..tostring(field)..' value:'..tostring(value))
        initialLevelState[objName][field] = levelObj:getField(field, "0")
        initialLevelState[objName][field] = levelObj:getField(field, "0")
        levelObj:setField(field, "", tostring(value))
      end
    else
      log('E', logTag, 'unable to find obj: ' .. tostring(objName))
    end
      scenario.vehicleIdToName[to.obj:getId()] = vecName
      log('D', logTag, "vehicle id: " ..tostring(to.obj:getId()) .. ' = ' .. tostring(vecName))
      scenario.vehicleIdToName[to.obj:getId()] = vecName
      log('D', logTag, "vehicle id: " ..tostring(to.obj:getId()) .. ' = ' .. tostring(vecName))
  for k, nodeName in ipairs(scenetree.findClassObjects('BeamNGWaypoint')) do
    --log('D', logTag, tostring(k) .. ' = ' .. tostring(nodeName))
    local o = scenetree.findObject(nodeName)
  for k, nodeName in ipairs(scenetree.findClassObjects('BeamNGWaypoint')) do
    --log('D', logTag, tostring(k) .. ' = ' .. tostring(nodeName))
    local o = scenetree.findObject(nodeName)
    else
      log('E', logTag, 'waypoint not found: ' .. tostring(nodeName))
    end
    for i, action in ipairs( scenario.blackListActions ) do
      --log('D', logTag, 'add action to blackList: ' .. tostring(action))
      inputActionFilter.addAction(0, action, true)
    for i, action in ipairs( scenario.whiteListActions ) do
      --log('D', logTag, 'add action to whiteList: ' .. tostring(action))
      inputActionFilter.addAction(0, action, false)

  log('D', logTag, 'Starting scenario : '..tostring(translateLanguage(scenario.name, scenario.name)))
  log('D', logTag, 'Scenario path : '..tostring(scenario.sourceFile))
  log('D', logTag, 'Starting scenario : '..tostring(translateLanguage(scenario.name, scenario.name)))
  log('D', logTag, 'Scenario path : '..tostring(scenario.sourceFile))
        debugDrawer:drawSphere(pp, n.radius, ColorF(0.5,0.5,0.5,0.3))
        debugDrawer:drawText(pp, String(tostring(nid)), ColorF(0,0,0,1))
      end
  if not state.errorMessage and validVehicles < scenario.playersCountRange.min then
    state.errorMessage = 'At least '..tostring(scenario.playersCountRange.min)..' players are required'
  end
  if not state.errorMessage and validVehicles > scenario.playersCountRange.max then
    state.errorMessage = 'Only up to '..tostring(scenario.playersCountRange.max)..' players are allowed'
  end
local function onScenarioUIReady(state)
  log('D', logTag, 'onScenarioUIReady('..tostring(state) .. ')')
  if not scenario then return end
  end
  log('D', logTag, 'should run: ' .. tostring(state == 'play' and scenario.state == 'pre-running') .. '; state: ' .. tostring(scenario.state))
  end
  log('D', logTag, 'should run: ' .. tostring(state == 'play' and scenario.state == 'pre-running') .. '; state: ' .. tostring(scenario.state))
  local vehicleId = vehicle:getID()
  -- log('I', logTag, 'initializeVehicle PlayerID: '..tostring(playerVehId)..' Spawned: '..tostring(vehicleId))
  if playerVehId == -1 or (vehicleId == playerVehId) then
  local vehicleId = vehicle:getID()
  -- log('I', logTag, 'initializeVehicle PlayerID: '..tostring(playerVehId)..' Spawned: '..tostring(vehicleId))
  if playerVehId == -1 or (vehicleId == playerVehId) then
          local vehicleData = extractVehicleData(vehicleId)
          -- log('I', "tickPreStart", '     checking : vehicle '..tostring(vehicle.obj:getId()).. '  '..dumps(vehicleData))
          if vehicleId == scenario.userSelectedVehicle.returnedVehicleId then
      for i, action in ipairs( scenario.blackListActions ) do
        --log('D', logTag, 'add action to blackList: ' .. tostring(action))
        inputActionFilter.addAction(0, action, true)
      for i, action in ipairs( scenario.whiteListActions ) do
        --log('D', logTag, 'add action to whiteList: ' .. tostring(action))
        inputActionFilter.addAction(0, action, false)
local function updateVehicleAiState(vehicleName, data)
  -- log('I',logTag, 'updateVehicleAiState called...'..tostring(vehicleName))
  -- dump(data)
@/lua/ge/extensions/editor/drivePathEditor/playback.lua
            routeSpeedMode,
            tostring(avoidCars),
            tostring(driveInLane),
            tostring(avoidCars),
            tostring(driveInLane),
            aggression,
            aggression,
            noOfLaps and tostring(noOfLaps) or "nil")
            vehicle.veh:queueLuaCommand(command)
            routeSpeedMode,
            tostring(avoidCars),
            tostring(driveInLane),
            tostring(avoidCars),
            tostring(driveInLane),
            aggression,
            aggression,
            noOfLaps and tostring(noOfLaps) or "nil")
            vehicle.veh:queueLuaCommand(luaCmd)
@/lua/common/libs/resty/template.lua
    if type(s) == "function" then return template.output(s()) end
    return tostring(s)
end
                layout.view = context.view
                return tostring(layout)
            end })
@/lua/ge/extensions/editor/gen/lib/ai.lua

--            lo('?? loss:'..tostring(a)..':'..tostring(b))
        local u = (b-a):normalized()

--            lo('?? loss:'..tostring(a)..':'..tostring(b))
        local u = (b-a):normalized()
        local u = (b-a):normalized()
--            lo('?? for_u:'..tostring(u))
        local s = 0
            local ds = (p - (a + u*(p-a):dot(u))):length()
--                lo('?? ds:'..i..':'..tostring(p)..':'..ds)
            s = s + ds
    local c = (mi+ma)/2
        lo('?? if_C:'..tostring(c))
    -- initialize
--    c = c/#set
--        lo('?? C2:'..tostring(c))
--        local u = (ma - mi):normalized()
--        local l = loss(ac)
--            lo('??___________________________ loss:'..tostring(l))
--        if true then return 0,ac,sac end

--        dump(ac, '<< line.ac:'..tostring(L2)..'/'..tostring(L1)..':'..(L2/L1))

--        dump(ac, '<< line.ac:'..tostring(L2)..'/'..tostring(L1)..':'..(L2/L1))
@/lua/common/jbeam/links.lua
                    if not rowValue.optional then
                      log('W', "jbeam.prepareLinksDestructive", "link target not found: " .. keyEntry .. "/" .. rowKey .. " > ".. sectionName.."/"..tValue .. " id1:" .. tostring(rowValue.id1) .. ", id2:" .. tostring(rowValue.id2) .. ", partPath:" .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. (rowValue.id1 == nil and rowValue.id2 == nil and rowValue.partPath == nil and ": "..dumps(rowValue) or ""))
                    else
                    if not rowValue.optional then
                      log('W', "jbeam.prepareLinksDestructive", "link target not found: " .. keyEntry .. "/" .. rowKey .. " > ".. sectionName.."/"..tValue .. " id1:" .. tostring(rowValue.id1) .. ", id2:" .. tostring(rowValue.id2) .. ", partPath:" .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. (rowValue.id1 == nil and rowValue.id2 == nil and rowValue.partPath == nil and ": "..dumps(rowValue) or ""))
                    else
                    if not rowValue.optional then
                      log('W', "jbeam.prepareLinksDestructive", "link target not found: " .. keyEntry .. "/" .. rowKey .. " > ".. sectionName.."/"..tValue .. " id1:" .. tostring(rowValue.id1) .. ", id2:" .. tostring(rowValue.id2) .. ", partPath:" .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. (rowValue.id1 == nil and rowValue.id2 == nil and rowValue.partPath == nil and ": "..dumps(rowValue) or ""))
                    else
              else
                log('W', "jbeam.prepareLinksDestructive", "link target section not existing: " .. tostring(sectionName) .. ", partPath:" .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. dumps(rowValue))
              end
              else
                log('W', "jbeam.prepareLinksDestructive", "link target section not existing: " .. tostring(sectionName) .. ", partPath:" .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. dumps(rowValue))
              end
            for cellKey,cellValue in pairs(rowValue) do
              --log('D', "jbeam.prepareLinksDestructive"," * key:"..tostring(cellKey).." = "..tostring(cellValue)..".")
              if str_find(cellKey, ':', 1, true) then
            for cellKey,cellValue in pairs(rowValue) do
              --log('D', "jbeam.prepareLinksDestructive"," * key:"..tostring(cellKey).." = "..tostring(cellValue)..".")
              if str_find(cellKey, ':', 1, true) then
                            if not rowValue.optional then
                              log('W', "jbeam.prepareLinksDestructive", "link target not found: " .. keyEntry .. "/" .. rowKey .. " > ".. sectionName.."/"..tValue .. " id1:" .. tostring(rowValue.id1) .. ", id2:" .. tostring(rowValue.id2) .. ", partPath: " .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. (rowValue.id1 == nil and rowValue.id2 == nil and rowValue.partPath == nil and ": "..dumps(rowValue) or ""))
                            else
                            if not rowValue.optional then
                              log('W', "jbeam.prepareLinksDestructive", "link target not found: " .. keyEntry .. "/" .. rowKey .. " > ".. sectionName.."/"..tValue .. " id1:" .. tostring(rowValue.id1) .. ", id2:" .. tostring(rowValue.id2) .. ", partPath: " .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. (rowValue.id1 == nil and rowValue.id2 == nil and rowValue.partPath == nil and ": "..dumps(rowValue) or ""))
                            else
                            if not rowValue.optional then
                              log('W', "jbeam.prepareLinksDestructive", "link target not found: " .. keyEntry .. "/" .. rowKey .. " > ".. sectionName.."/"..tValue .. " id1:" .. tostring(rowValue.id1) .. ", id2:" .. tostring(rowValue.id2) .. ", partPath: " .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. (rowValue.id1 == nil and rowValue.id2 == nil and rowValue.partPath == nil and ": "..dumps(rowValue) or ""))
                            else
                            if not rowValue.optional then
                              log('W', "jbeam.prepareLinksDestructive", "link target not found: " .. keyEntry .. "/" .. rowKey .. " > ".. sectionName.."/"..cellValue .. " id1:" .. tostring(rowValue.id1) .. ", id2:" .. tostring(rowValue.id2) .. ", partPath: " .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. (rowValue.id1 == nil and rowValue.id2 == nil and rowValue.partPath == nil and ": "..dumps(rowValue) or ""))
                            else
                            if not rowValue.optional then
                              log('W', "jbeam.prepareLinksDestructive", "link target not found: " .. keyEntry .. "/" .. rowKey .. " > ".. sectionName.."/"..cellValue .. " id1:" .. tostring(rowValue.id1) .. ", id2:" .. tostring(rowValue.id2) .. ", partPath: " .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. (rowValue.id1 == nil and rowValue.id2 == nil and rowValue.partPath == nil and ": "..dumps(rowValue) or ""))
                            else
                            if not rowValue.optional then
                              log('W', "jbeam.prepareLinksDestructive", "link target not found: " .. keyEntry .. "/" .. rowKey .. " > ".. sectionName.."/"..cellValue .. " id1:" .. tostring(rowValue.id1) .. ", id2:" .. tostring(rowValue.id2) .. ", partPath: " .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. (rowValue.id1 == nil and rowValue.id2 == nil and rowValue.partPath == nil and ": "..dumps(rowValue) or ""))
                            else
                    else
                      log('W', "jbeam.prepareLinksDestructive", "link target section not existing: " .. tostring(sectionName) .. ", partPath:" .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. dumps(rowValue))
                    end
                    else
                      log('W', "jbeam.prepareLinksDestructive", "link target section not existing: " .. tostring(sectionName) .. ", partPath:" .. tostring(rowValue.partPath) .. " - DATA DISCARDED".. dumps(rowValue))
                    end
@/lua/ge/extensions/editor/rallyEditor/recceTab.lua

    im.Text('driveline: '..tostring(#self.recce.driveline.points)..' points, '..self:formatDistance(dist))
    if #self.recce.cuts > 0 then
    if #self.recce.cuts > 0 then
      im.Text('cuts: '..tostring(#self.recce.cuts)..' (the little green cars)')
    else
    else
      im.Text('cuts: '..tostring(#self.recce.cuts))
    end
@/lua/ge/extensions/editor/roadTemplateEditor.lua
  local decoObject = createObject('SimGroup')
  decoObject:registerObject("deco" .. tostring(decoCounter))
  decoCounter = decoCounter + 1
@/lua/vehicle/material.lua
      end
      -- log('W', "material.funcChanged", "switchMaterial(" .. tostring(va.msc) .. ", '" .. tostring(newMat).."')")
      if newMat == nil then
      end
      -- log('W', "material.funcChanged", "switchMaterial(" .. tostring(va.msc) .. ", '" .. tostring(newMat).."')")
      if newMat == nil then
    else
      log("E", "material.init", tostring(err))
      t.evalFunction = nop
@/lua/ge/extensions/editor/util/plotHelperUtil.lua
    if txtPos then
      txt = tostring(abs(graphX))
      if #txt <= 5 then
        txt = tostring(graphX)
      else
    if txtPos then
      txt = tostring(abs(graphY))
      if #txt <= 5 then
        txt = tostring(graphY)
      else
@/lua/ge/extensions/editor/terrainEditor.lua
  if paintMaterialCount ~= count then
    editor.logWarn("Material count mismatch! paintMaterialCount = " .. tostring(paintMaterialCount) .. " count = " .. tostring(count))
  end
  if paintMaterialCount ~= count then
    editor.logWarn("Material count mismatch! paintMaterialCount = " .. tostring(paintMaterialCount) .. " count = " .. tostring(count))
  end
@/lua/ge/extensions/ui/extApp.lua
local function updateUIData()
  local url = 'http://' .. chosenAddress .. ':'.. tostring(port)
  guihooks.trigger('externalUIURL', url)
  server, chosenAddress = wsUtils.createOrGetWS('any', port, './', protocolName, '/ui/entrypoints/main/index.html')
  print('ext app webserver running at: http://' .. chosenAddress .. ':' .. tostring(port) .. ' (listening on all addresses)')
  updateUIData()
@/lua/ge/extensions/core/multiSpawn.lua
      table.insert(vehIds, veh:getId())
      veh:setDynDataFieldbyName('vehicleGroup', 0, tostring(spawnOptions.name))
    else
@/lua/ge/extensions/scenario/speedGoal.lua
      if countdown > 0 then
        helper.flashUiMessage({txt = "extensions.scenario.speedGoal.countdown", context = {countdown = tostring(countdown)}}, 0.5, true)
      end
@/lua/common/tcpServer.lua
    else
      log('E', 'TCPServer', 'Failed to start luasocket server: ' .. tostring(err))
      return false
    if not data then
      log('E', 'TCPServer', 'Unable to decode message from connection ' .. tostring(connection:get_remote_endpoint()))
      self:sendData(connection, {cmd = "error", message = "unable to decode json data"})
        if err ~= "timeout" then
          log('E', 'TCPServer', 'Error accepting connection: ' .. tostring(err))
        end
@/lua/common/libs/inspect/inspect.lua
  end
  return tostring(id)
end
  if t == inspect.KEY or t == inspect.METATABLE then
    self:puts(tostring(t))
  elseif self:alreadyVisited(t) then
         tv == 'cdata' or tv == 'ctype' then
    self:puts(tostring(v))
  elseif tv == 'table' then
@/lua/ge/extensions/core/input/virtualInput.lua
  end
  mgr:unregisterDevice('vinput' .. tostring(deviceInstance))
  local deviceInfo = M.devices[deviceInstance]
@/lua/ge/extensions/core/busRouteManager.lua
local function vehicleCommand(id,cmd,arg)
  -- log("E", logTag, "vehicleCommand id='"..tostring(id).."' cmd='"..tostring(cmd).."' arg='"..dumps(arg).."'")
  if arg ==nil then arg =""end
local function vehicleCommand(id,cmd,arg)
  -- log("E", logTag, "vehicleCommand id='"..tostring(id).."' cmd='"..tostring(cmd).."' arg='"..dumps(arg).."'")
  if arg ==nil then arg =""end
    else
      log("E", logTag, "vehicle ID '"..tostring(id).."' is invalid  cmd='"..tostring(cmd).."'")
    end
    else
      log("E", logTag, "vehicle ID '"..tostring(id).."' is invalid  cmd='"..tostring(cmd).."'")
    end
        table.insert( task_data, triggerPos[task])
      else log("E", logtagFN("load.chkTrigger"), "Trigger '"..tostring(task).."' doesn't exist on this map or type != 'busstop'")
      end
@/lua/common/jbeam/interaction.lua
  for _, filename in ipairs(interactionFilenames) do
    --log('I', 'events', 'loaded interaction file: ' .. tostring(filename))
    local j = jsonReadFile(filename)
    if j.fileversion ~= supportedFileVersion then
      log('E', 'interaction', 'interaction file wrong version. Supported version ' .. tostring(supportedFileVersion) .. ' - found version ' .. tostring(j.fileversion) .. '. Ignoring file ' .. tostring(filename))
      goto continue
    if j.fileversion ~= supportedFileVersion then
      log('E', 'interaction', 'interaction file wrong version. Supported version ' .. tostring(supportedFileVersion) .. ' - found version ' .. tostring(j.fileversion) .. '. Ignoring file ' .. tostring(filename))
      goto continue
    if j.fileversion ~= supportedFileVersion then
      log('E', 'interaction', 'interaction file wrong version. Supported version ' .. tostring(supportedFileVersion) .. ' - found version ' .. tostring(j.fileversion) .. '. Ignoring file ' .. tostring(filename))
      goto continue
@/lua/ge/extensions/scenario/waypointAction.lua
      if next(instance.value.wayPointNum) == nil then
        log('E', 'In '..tostring(scenario.name), ' wayPointNum is empty ')
        goto continue
      if next(scenario.lapConfig) == nil then
        log('E', 'In '..tostring(scenario.name), ' lapConfig is empty ')
        goto continue
        else
          log('E', 'In '..tostring(scenario.name), ' wayPointNum must be a number ')
          goto continue
      if instance.value.wayPointNum and type(instance.value.wayPointNum) ~="table" then
        log('E', 'In '..tostring(scenario.name), ' wayPointNum is not of type array ')
        goto continue
@/lua/vehicle/extensions/vehicleStatsLogger.lua
    if settings.useStat[moduleID][statID] then
      line = line .. tostring(record[moduleID][statID].get()) .. csvSeparator
    else
  -- for moduleID, useModule in pairs(settings.useModule) do
  --     log("D", logTag, moduleID..": "..tostring(useModule))
  -- end
@/lua/common/extensions/ui/imguiWire.lua
  for _, j in ipairs(t) do
    id = id .. '|' .. tostring(j)
  end
@/lua/ge/extensions/ui/appSelector/general.lua
  -- Apps don't have folder exploration
  log("I", "", "App selector explore folder: " .. tostring(path))
end
  -- Apps don't have mod navigation
  log("I", "", "App selector go to mod: " .. tostring(modId))
end
@/lua/ge/extensions/util/testJSONFilesSyntax.lua
  if state == false then
    log('E', "jsonDecode", "unable to decode JSON: "..tostring(context))
    log('E', "jsonDecode", "JSON decoding error: "..tostring(data))
    log('E', "jsonDecode", "unable to decode JSON: "..tostring(context))
    log('E', "jsonDecode", "JSON decoding error: "..tostring(data))
    return nil
@/lua/common/jbeam/sections/camera.lua
      if v.name == nil or type(v.name) ~= 'string' then
        v.name = 'onboard_' .. tostring(counter)
        v.order = v.order or counter + 20
      if foundCameras[v.name] then
        log('E', "jbeam.pushToPhysics", "Ignoring onboard camera with duplicate name: " .. tostring(v.name))
      end
@/lua/vehicle/powertrain/splitShaft.lua

  device.primaryOutputTorqueName = "outputTorque" .. tostring(primaryOutputID)
  device.primaryOutputAVName = "outputAV" .. tostring(primaryOutputID)
  device.primaryOutputTorqueName = "outputTorque" .. tostring(primaryOutputID)
  device.primaryOutputAVName = "outputAV" .. tostring(primaryOutputID)
  device.secondaryOutputTorqueName = "outputTorque" .. tostring(secondaryOutputID)
  device.primaryOutputAVName = "outputAV" .. tostring(primaryOutputID)
  device.secondaryOutputTorqueName = "outputTorque" .. tostring(secondaryOutputID)
  device.secondaryOutputAVName = "outputAV" .. tostring(secondaryOutputID)
  device.secondaryOutputTorqueName = "outputTorque" .. tostring(secondaryOutputID)
  device.secondaryOutputAVName = "outputAV" .. tostring(secondaryOutputID)
@/lua/common/libs/luamqtt/mqtt/protocol4.lua
	else
		return false, "unexpected packet type received: "..tostring(ptype)
	end
@/lua/ge/extensions/core/vehicleTriggers.lua
    if debugUIEnabled then
      log('I', 'triggers', 'Executing trigger code: ' .. tostring(cmd))
    end
      if not vdata.inputActions[lnk.inputAction] then
        log('E', 'triggers', 'input action not found: ' .. tostring(lnk.inputAction))
        return 0
        if not vdata.inputActions[lnk.inputAction] then
          log('E', 'triggers', 'input action not found: ' .. tostring(lnk.inputAction))
          return 0
      if debugUIEnabled and triggerdBindingCount == 0 then
        log('W', 'triggers', 'No binding triggered: ' .. tostring(lnk.inputAction) .. ' for value ' .. tostring(value) )
      end
      if debugUIEnabled and triggerdBindingCount == 0 then
        log('W', 'triggers', 'No binding triggered: ' .. tostring(lnk.inputAction) .. ' for value ' .. tostring(value) )
      end

      local open = im.TreeNodeEx1("Vehicle " .. tostring(vehId) .. '##vehicle' .. tostring(vehId))
      im.SameLine()

      local open = im.TreeNodeEx1("Vehicle " .. tostring(vehId) .. '##vehicle' .. tostring(vehId))
      im.SameLine()
      if vData.vdata then
        title = tostring(vData.vdata.model)
      end
      if vData.config then
        local dir, filename, ext = path.splitWithoutExt(tostring(vData.config.partConfigFilename))
        im.TextUnformatted(filename)
        local triggerCount = vData.vdata.maxIDs and vData.vdata.maxIDs.triggers or 0
        local open2 = im.TreeNodeEx1("Triggers##triggers"..tostring(vehId))
        im.SameLine()
        im.PushStyleColor2(im.Col_Text, im.ImVec4(1, 1, 0, 1))
        im.TextUnformatted(tostring(triggerCount))
        im.PopStyleColor()
        if open2 then
          if im.BeginTable('Triggers##vehicleTriggers'..tostring(vehId), 5, tableFlags) then
            im.TableSetupScrollFreeze(0, 1) -- Make top row always visible
                      im.TableNextColumn()
                      im.TextUnformatted(tostring(trg.cid))
                      im.TableNextColumn()
                        -- triggers2
                        im.TextUnformatted(tostring(lnk.inputAction))
                        im.TableNextColumn()
                        im.TableNextColumn()
                        im.TextUnformatted(tostring(lnk.namespace))
                        if lnk.namespace == 'common' then
                          im.SameLine()
                          im.TextUnformatted(tostring(lnk.commonLua and "[LUA]" or "[C++]"))
                        end
                          im.SameLine()
                          im.TextUnformatted(' (' .. tostring(trg.originSection) .. ')')
                        end
                        im.TableNextColumn()
                        im.SmallButton((tostring(lnk.triggerInput) or 'trigger') .. '##lnk2_'..tostring(lnk.cid)..'_'..tostring(vehId))
                        im.TableNextColumn()
                        im.SmallButton((tostring(lnk.triggerInput) or 'trigger') .. '##lnk2_'..tostring(lnk.cid)..'_'..tostring(vehId))
                        im.TableNextColumn()
                        im.SmallButton((tostring(lnk.triggerInput) or 'trigger') .. '##lnk2_'..tostring(lnk.cid)..'_'..tostring(vehId))
                        -- triggers (1)
                        im.TextUnformatted(tostring(lnk.action) .. ' - ' .. tostring(lnk.targetEvent.name))
                        im.SameLine()
                        -- triggers (1)
                        im.TextUnformatted(tostring(lnk.action) .. ' - ' .. tostring(lnk.targetEvent.name))
                        im.SameLine()
                        im.SameLine()
                        im.SmallButton('trigger##lnk_'..tostring(lnk.cid)..'_'..tostring(vehId))
                        if im.IsItemHovered() and im.IsMouseClicked(0) then
                        im.SameLine()
                        im.SmallButton('trigger##lnk_'..tostring(lnk.cid)..'_'..tostring(vehId))
                        if im.IsItemHovered() and im.IsMouseClicked(0) then
                      im.SameLine()
                      if not isSelected and im.SmallButton('highlight##highlight_'..tostring(trg.cid) .. '_' .. tostring(actionStr)) then
                        highLightedTriggerData = {vehId, trg.cid}
                      im.SameLine()
                      if not isSelected and im.SmallButton('highlight##highlight_'..tostring(trg.cid) .. '_' .. tostring(actionStr)) then
                        highLightedTriggerData = {vehId, trg.cid}
        local eventsCount = vData.vdata.maxIDs and vData.vdata.maxIDs.events or 0
        local open3 = im.TreeNodeEx1("Events##Events"..tostring(vehId))
        im.SameLine()
        im.PushStyleColor2(im.Col_Text, im.ImVec4(1, 1, 0, 1))
        im.TextUnformatted(tostring(eventsCount))
        im.PopStyleColor()
        if open3 then
          if im.BeginTable('Events##vehicleEventNames'..tostring(vehId), 4, tableFlags) then
            im.TableSetupScrollFreeze(0, 1) -- Make top row always visible
                im.TableNextColumn()
                im.TextUnformatted(tostring(evt.cid))
                im.TableNextColumn()

                im.SmallButton('trigger##u'..tostring(evt.cid)..'_'..tostring(vehId))
                if im.IsItemHovered() and im.IsMouseClicked(0) and evt.onDown then

                im.SmallButton('trigger##u'..tostring(evt.cid)..'_'..tostring(vehId))
                if im.IsItemHovered() and im.IsMouseClicked(0) and evt.onDown then
                if evt.onUp ~= nil then
                  if im.SmallButton('up##u'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    queueCmd(vehId, evt.onUp)
                if evt.onUp ~= nil then
                  if im.SmallButton('up##u'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    queueCmd(vehId, evt.onUp)
                  if sameLineNeeded then im.SameLine() end
                  if im.SmallButton('down##d'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    queueCmd(vehId, evt.onDown)
                  if sameLineNeeded then im.SameLine() end
                  if im.SmallButton('down##d'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    queueCmd(vehId, evt.onDown)
                  if sameLineNeeded then im.SameLine() end
                  if im.SmallButton('-1##z'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    local cmdStr = evt.onChange:gsub("VALUE", tostring(-1))
                  if sameLineNeeded then im.SameLine() end
                  if im.SmallButton('-1##z'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    local cmdStr = evt.onChange:gsub("VALUE", tostring(-1))
                  if im.SmallButton('-1##z'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    local cmdStr = evt.onChange:gsub("VALUE", tostring(-1))
                    print('-1 - '..cmdStr)
                  im.SameLine()
                  if im.SmallButton('0##z'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    local cmdStr = evt.onChange:gsub("VALUE", tostring(0))
                  im.SameLine()
                  if im.SmallButton('0##z'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    local cmdStr = evt.onChange:gsub("VALUE", tostring(0))
                  if im.SmallButton('0##z'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    local cmdStr = evt.onChange:gsub("VALUE", tostring(0))
                    print('0 - '..cmdStr)
                  im.SameLine()
                  if im.SmallButton('1##o'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    local cmdStr = evt.onChange:gsub("VALUE", tostring(1))
                  im.SameLine()
                  if im.SmallButton('1##o'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    local cmdStr = evt.onChange:gsub("VALUE", tostring(1))
                  if im.SmallButton('1##o'..tostring(evt.cid)..'_'..tostring(vehId)) then
                    local cmdStr = evt.onChange:gsub("VALUE", tostring(1))
                    print('1 - '..cmdStr)
        local eventsCount = vData.vdata.maxIDs and vData.vdata.maxIDs.triggerEventLinksDict or 0
        local open4 = im.TreeNodeEx1("TriggerEventLinks##TriggerEventLinks"..'_'..tostring(vehId))
        im.SameLine()
        im.PushStyleColor2(im.Col_Text, im.ImVec4(1, 1, 0, 1))
        im.TextUnformatted(tostring(eventsCount))
        im.PopStyleColor()
        if open4 then
          if im.BeginTable('TriggerEventLinks##TriggerEventLinks'..tostring(vehId), 2, tableFlags) then
            im.TableSetupScrollFreeze(0, 1) -- Make top row always visible
                im.TableNextColumn()
                im.TextUnformatted(tostring(triggerId))
                im.TableNextColumn()
                      -- triggers2
                      im.TextUnformatted(tostring(lnk.triggerInput) .. ' - ' .. tostring(lnk.inputAction))
                      im.SameLine()
                      -- triggers2
                      im.TextUnformatted(tostring(lnk.triggerInput) .. ' - ' .. tostring(lnk.inputAction))
                      im.SameLine()
                      im.SameLine()
                      im.SmallButton('trigger##u'..tostring(lnk.cid)..'_'..tostring(vehId))
                      if im.IsItemHovered() and im.IsMouseClicked(0) then
                      im.SameLine()
                      im.SmallButton('trigger##u'..tostring(lnk.cid)..'_'..tostring(vehId))
                      if im.IsItemHovered() and im.IsMouseClicked(0) then
                      -- triggers (1)
                      im.TextUnformatted(tostring(lnk.action) .. ' - ' .. tostring(lnk.targetEvent.name))
                      im.SameLine()
                      -- triggers (1)
                      im.TextUnformatted(tostring(lnk.action) .. ' - ' .. tostring(lnk.targetEvent.name))
                      im.SameLine()
                      im.SameLine()
                      im.SmallButton('trigger##u'..tostring(lnk.cid)..'_'..tostring(vehId))
                      if im.IsItemHovered() and im.IsMouseClicked(0) then
                      im.SameLine()
                      im.SmallButton('trigger##u'..tostring(lnk.cid)..'_'..tostring(vehId))
                      if im.IsItemHovered() and im.IsMouseClicked(0) then

        local text = tostring(highLightedTriggerId) .. ' - ' .. tostring(trg.name) .. ' [' .. tostring(trg.originSection or 'triggers') .. ']'
        debugDrawer:drawTextAdvanced(pos, String(text), ColorF(1,1,1,1), true, false, ColorI(0,0,0,192))

        local text = tostring(highLightedTriggerId) .. ' - ' .. tostring(trg.name) .. ' [' .. tostring(trg.originSection or 'triggers') .. ']'
        debugDrawer:drawTextAdvanced(pos, String(text), ColorF(1,1,1,1), true, false, ColorI(0,0,0,192))

        local text = tostring(highLightedTriggerId) .. ' - ' .. tostring(trg.name) .. ' [' .. tostring(trg.originSection or 'triggers') .. ']'
        debugDrawer:drawTextAdvanced(pos, String(text), ColorF(1,1,1,1), true, false, ColorI(0,0,0,192))
    if debugUIEnabled and actionsExecuted == 0 then
      local valuetext = tostring(actionValue)
      if actionValue == 1 then
  local vData = extensions.core_vehicle_manager.getVehicleData(vehicleId)
  local actionStr = 'action'..tostring(actionNum)
  return triggerEvent(actionStr, actionValue, triggerId, vehicleId, vData.vdata)
      --print(inputValue)
      triggerEvent('action' .. tostring(actionNumber), inputValue, currentTriggerHit.t, currentTriggerHit.v, vData.vdata)
      if inputValue ~= 0 then
@/lua/ge/spawn.lua

  local autoEnterVehicle = tostring(options.autoEnterVehicle ~= false) -- nil defaults to 'true'
  veh:setDynDataFieldbyName("autoEnterVehicle", 0, autoEnterVehicle)

  local autoEnterVehiclePlayer = options.autoEnterVehiclePlayer ~= nil and tostring(options.autoEnterVehiclePlayer) or ""
  veh:setDynDataFieldbyName("autoEnterVehiclePlayer", 0, autoEnterVehiclePlayer)
  while scenetree.findObject(vehicleName) do
    vehicleName = "clone" .. tostring(i)
    i = i + 1
@/lua/common/jbeam/sections/wheels.lua

  --log('D', "jbeam.addWheel","n1 = " .. tostring(node1_pos) .. " , n2 = " .. tostring(node2_pos))

  --log('D', "jbeam.addWheel","n1 = " .. tostring(node1_pos) .. " , n2 = " .. tostring(node2_pos))

  --log('D', "jbeam.addWheel","wheel axis:" .. tostring(axis))
  local rayVec = axis:perpendicularN() * wheel.radius
  --log('D', "jbeam.addWheel","rayVector: " .. tostring(rayVec))
  local rayRot = quatFromAxisAngle(axis, 2 * math.pi / (wheel.numRays* 2))
  --log('D', "jbeam.addWheel","rayRot: " .. tostring(rayRot))

  --log('D', "jbeam.addMonoHubWheel","n1 = " .. tostring(node1_pos) .. " , n2 = " .. tostring(node2_pos))

  --log('D', "jbeam.addMonoHubWheel","n1 = " .. tostring(node1_pos) .. " , n2 = " .. tostring(node2_pos))

  --log('D', "jbeam.addMonoHubWheel","wheel axis:" .. tostring(axis))
  local rayVec = axis:perpendicularN() * wheel.radius
  --log('D', "jbeam.addMonoHubWheel","rayVector: " .. tostring(rayVec))

  --log('D', "jbeam.addMonoHubWheel","rayRot: " .. tostring(rayRot))
  rayRot = quatFromAxisAngle(axis, 2 * math.pi / (wheel.numRays))
  --log('D', "jbeam.addMonoHubWheel","rayVector: " .. tostring(rayVec))

  --log('D', "jbeam.addHubWheel","n1 = " .. tostring(node1_pos) .. " , n2 = " .. tostring(node2_pos))

  --log('D', "jbeam.addHubWheel","n1 = " .. tostring(node1_pos) .. " , n2 = " .. tostring(node2_pos))

  --log('D', "jbeam.addHubWheel","wheel axis:" .. tostring(axis))
  local rayVec = axis:perpendicularN() * wheel.radius
  --log('D', "jbeam.addHubWheel","rayVector: " .. tostring(rayVec))
  local rayRot = quatFromAxisAngle(axis, 2 * math.pi / (wheel.numRays* 2))
  --log('D', "jbeam.addHubWheel","rayRot: " .. tostring(rayRot))
      local v = vehicle[wheelSection][k]
      --log('D', "jbeam.processWheel"," * "..tostring(k).." = "..tostring(v).." ["..type(v).."]")
      if v.numRays == nil or v.numRays > 0 then
      local v = vehicle[wheelSection][k]
      --log('D', "jbeam.processWheel"," * "..tostring(k).." = "..tostring(v).." ["..type(v).."]")
      if v.numRays == nil or v.numRays > 0 then
      local rotData = vehicle.rotators[rotId]
      --log('D', "jbeam.postProcess"," * "..tostring(k).." = "..tostring(v).." ["..type(v).."]")
      local wheelID = jbeamUtils.increaseMax(vehicle, 'wheels')
      local rotData = vehicle.rotators[rotId]
      --log('D', "jbeam.postProcess"," * "..tostring(k).." = "..tostring(v).." ["..type(v).."]")
      local wheelID = jbeamUtils.increaseMax(vehicle, 'wheels')
@/lua/ge/extensions/editor/api/valueInspector.lua
          for tagId = 0, 2 do
            local tag = obj:getField("materialTag", tostring(tagId))
            if tag and imgui.ImGuiTextFilter_PassFilter(simSetNameFilter, tag) then
      imgui.Text("ID:") imgui.SameLine()
      imgui.Text(tostring(obj:getId()))
      imgui.Text("PID:") imgui.SameLine()
      else
        fieldValue = tostring(self.input4FloatValue[0])
      end
      else
        fieldValue = tostring(self.input4FloatValue[0])
      end
      else
        fieldValue = tostring(self.input4IntValue[0])
      end
      else
        fieldValue = tostring(self.input4IntValue[0])
      end
    if imgui.Checkbox(fieldNameId, self.inputBoolValue) then
      self.setValueCallback(fieldName, tostring(self.inputBoolValue[0]), arrayIndex, customData, true)
    end
      fieldValue =
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2])
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2])
      fieldValueCached = fieldValue
      fieldValue =
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2])
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2])
      self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
      fieldValueCached = fieldValue
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
      fieldValueCached = fieldValue
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
      self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
      self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1]) .. " " .. tostring(self.input4FloatValue[2]) .. " " .. tostring(self.input4FloatValue[3])
      fieldValueCached = fieldValue
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1]) .. " " .. tostring(self.input4FloatValue[2]) .. " " .. tostring(self.input4FloatValue[3])
      fieldValueCached = fieldValue
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1]) .. " " .. tostring(self.input4FloatValue[2]) .. " " .. tostring(self.input4FloatValue[3])
      fieldValueCached = fieldValue
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1]) .. " " .. tostring(self.input4FloatValue[2]) .. " " .. tostring(self.input4FloatValue[3])
      fieldValueCached = fieldValue
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1]) .. " " .. tostring(self.input4FloatValue[2]) .. " " .. tostring(self.input4FloatValue[3])
      self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1]) .. " " .. tostring(self.input4FloatValue[2]) .. " " .. tostring(self.input4FloatValue[3])
      self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1]) .. " " .. tostring(self.input4FloatValue[2]) .. " " .. tostring(self.input4FloatValue[3])
      self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1]) .. " " .. tostring(self.input4FloatValue[2]) .. " " .. tostring(self.input4FloatValue[3])
      self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
      fieldValueCached = fieldValue
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
      fieldValueCached = fieldValue
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
      self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
      if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
      fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
      self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
        fieldValue =
               tostring(degToRad(self.input4FloatValue[0])) ..
        " " .. tostring(degToRad(self.input4FloatValue[1])) ..
               tostring(degToRad(self.input4FloatValue[0])) ..
        " " .. tostring(degToRad(self.input4FloatValue[1])) ..
        " " .. tostring(degToRad(self.input4FloatValue[2]))
        " " .. tostring(degToRad(self.input4FloatValue[1])) ..
        " " .. tostring(degToRad(self.input4FloatValue[2]))
        fieldValueCached = fieldValue
        fieldValue =
          tostring(degToRad(self.input4FloatValue[0])) .. " " ..
          tostring(degToRad(self.input4FloatValue[1])) .. " " ..
          tostring(degToRad(self.input4FloatValue[0])) .. " " ..
          tostring(degToRad(self.input4FloatValue[1])) .. " " ..
          tostring(degToRad(self.input4FloatValue[2]))
          tostring(degToRad(self.input4FloatValue[1])) .. " " ..
          tostring(degToRad(self.input4FloatValue[2]))
        self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
      fieldValue =
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[3])
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[3])
      fieldValueCached = fieldValue
      fieldValue =
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[3])
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[3])
      self.setValueCallback(fieldName, fieldValueCached or fieldValue, arrayIndex, customData, self.editEnded[0])
      fieldValue =
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[3])
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[3])
      fieldValue =
        tostring(math.floor(self.input4FloatValue[0] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[1] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[0] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[1] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[2] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[1] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[2] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[3] * 255 + 0.5))
        tostring(math.floor(self.input4FloatValue[2] * 255 + 0.5)) .. " " ..
        tostring(math.floor(self.input4FloatValue[3] * 255 + 0.5))
      fieldValue =
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[0]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[1]) .. " " ..
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[3])
        tostring(self.input4FloatValue[2]) .. " " ..
        tostring(self.input4FloatValue[3])
      self.setValueCallback(fieldName, fieldValue, arrayIndex, customData, self.editEnded[0])
        else
          fieldValue = tostring(customData.enum[index].name)
        end
@/lua/vehicle/bullettime.lua
local function set(v)
  obj:queueGameEngineLua('simTimeAuthority.set('..tostring(1/v)..')')
end
@/lua/ge/extensions/ui/gameplaySelector/general.lua
  end
  log("I", "", "Gameplay selector display data updated to version " .. tostring(version))
  return data
  -- TODO: Implement folder exploration
  log("I", "", "Gameplay selector explore folder: " .. tostring(path))
end
  -- TODO: Implement mod navigation
  log("I", "", "Gameplay selector go to mod: " .. tostring(modId))
end
@/lua/console/unittests.lua
    a = vec3(0,0,0)
    assert(tostring(a) == "(0, 0, 0)", "vec3 constructor test failed")
    a = vec3(1.234,2.134,3.124)
    a = vec3(1.234,2.134,3.124)
    assert(tostring(a) == "(1.234, 2.134, 3.124)", "vec3 float point test failed")
    a = vec3(0,1337.13371337,-1)
    a = vec3(0,1337.13371337,-1)
    assert(tostring(a) == "(0, 1337.134, -1)", "vec3 float point test 2 failed")
    a = vec3(0,133007.133,-1)
    a = vec3(0,133007.133,-1)
    assert(tostring(a) == "(0, 133007.141, -1)", "vec3 float point precision test failed")
    c = a + b
    assert(tostring(c) == "(3, 2, 1)", "vec3 operator +")
    c = a - b
    c = a - b
    --log('D', "lua.unittests", tostring(c))
    assert(tostring(c) == "(-1, -2, 5)", "vec3 operator -")
    --log('D', "lua.unittests", tostring(c))
    assert(tostring(c) == "(-1, -2, 5)", "vec3 operator -")
    c = a * b
    c = a * b
    assert(tostring(c) == "(2, 0, -6)", "vec3 operator *")
    c = a / b
    c = a / b
    assert(tostring(c) == "(0.5, 0, -1.5)", "vec3 operator /")
    c = -a
    c = -a
    assert(tostring(c) == "(-1, -0, -3)", "vec3 unary -")
@/lua/ge/extensions/gameplay/drift/drift.lua
  if isBeingDebugged then
    debugDrawer:drawTextAdvanced(center, "Reverse cheesing : " .. tostring(isReverseCheesing), ColorF(1,1,1,1), true, false, ColorI(0,0,0,255), false, false)
  end
@/lua/ge/extensions/ui/vehicleSelector/general.lua
  end
  log("I", "", "Display data updated to version " .. tostring(version))
  return data
@/lua/console/json-performance.lua
local filenames = FS:findFiles('/vehicles', '*.jbeam', -1, false, false)
print(' * Finding all ' .. tostring(#filenames) .. ' json files took ' ..  string.format('%0.3f', hp:stopAndReset()) .. 's')
  totalSize = totalSize + string.len(fileContent[filename])
  --print(' * ' ..tostring(filename))
end
    for filename, content in pairs(fileContent) do
      --print(' * ' ..tostring(filename))
      local state, data = xpcall(jdecode, debug.traceback, content)
      if state == false then
        print("unable to decode JSON: "..tostring(filename))
        print("jsonDecode", "JSON decoding error: "..tostring(data))
        print("unable to decode JSON: "..tostring(filename))
        print("jsonDecode", "JSON decoding error: "..tostring(data))
        return nil
  local totalSizeReruns = totalSize * reruns
  print(' * Parsing (' .. tostring(reruns) .. 'x = '.. string.format('%0.3f', totalSizeReruns /1000000 ) .. ' MB) took ' .. string.format('%0.3f', t) .. 's. Performance: ' .. string.format('%0.3f', (totalSizeReruns/1000000) / t  ) .. ' MB/s'..string.format(' in %0.3f sec', t))
end
for filename, content in pairs(fileContent) do
  --print(' * ' ..tostring(filename))
  local state, data = pcall(json.decode, content)
    for filename, content in pairs(luaContent) do
      --print(' * ' ..tostring(filename))
      lpackContent[filename] = lpack.encode(content)
  print('Total packed size = '..totalPackSize)
  print(' * Encoding (' .. tostring(reruns) .. 'x = '.. string.format('%0.3f', totalSizeReruns /1000000 ) .. ' MB) took ' .. string.format('%0.3f', t) .. 's. Performance: ' .. string.format('%0.3f', (totalSizeReruns/1000000) / t  ) .. ' MB/s'..string.format(' in %0.3f sec', t))
end
    for filename, content in pairs(lpackContent) do
      --print(' * ' ..tostring(filename))
      lpack.decode(content)
  local totalSizeReruns = totalPackSize
  print(' * Parsing (' .. tostring(reruns) .. 'x = '.. string.format('%0.3f', totalSizeReruns /1000000 ) .. ' MB) took ' .. string.format('%0.3f', t) .. 's. Performance: ' .. string.format('%0.3f', (totalSizeReruns/1000000) / t  ) .. ' MB/s'..string.format(' in %0.3f sec', t))
end
    for filename, content in pairs(luaContent) do
      --print(' * ' ..tostring(filename))
      lpackContent[filename] = lpack.encodeBin(content)
  print('Total packed size = '..totalPackSize)
  print(' * Encoding (' .. tostring(reruns) .. 'x = '.. string.format('%0.3f', totalSizeReruns /1000000 ) .. ' MB) took ' .. string.format('%0.3f', t) .. 's. Performance: ' .. string.format('%0.3f', (totalSizeReruns/1000000) / t  ) .. ' MB/s'..string.format(' in %0.3f sec', t))
end
    for filename, content in pairs(luaContent) do
      strbufContent[filename] = tostring(buffer.encode(content))
      totalPackSize = totalPackSize + #strbufContent[filename]
  print('Total packed size = '..totalPackSize)
  print(' * Encoding (' .. tostring(reruns) .. 'x = '.. string.format('%0.3f', totalSizeReruns /1000000 ) .. ' MB) took ' .. string.format('%0.3f', t) .. 's. Performance: ' .. string.format('%0.3f', (totalSizeReruns/1000000) / t  ) .. ' MB/s'..string.format(' in %0.3f sec', t))
end
  local totalSizeReruns = totalPackSize
  print(' * Parsing (' .. tostring(reruns) .. 'x = '.. string.format('%0.3f', totalSizeReruns /1000000 ) .. ' MB) took ' .. string.format('%0.3f', t) .. 's. Performance: ' .. string.format('%0.3f', (totalSizeReruns/1000000) / t  ) .. ' MB/s'..string.format(' in %0.3f sec', t))
end
@/lua/vehicle/controller/tech/cosimulationCoupling.lua
  for i=1,length,1 do
    out[i] = tostring(i)
  end
@/lua/ge/extensions/gameplay/rally/util.lua
  else
    local err = 'unable to find corner_angles file: ' .. tostring(filename)
    log('E', 'rally', err)
local function getMissionName(missionId)
  -- log('D', 'rallyUtil', 'getMissionName: missionId = ' .. tostring(missionId))
  local mission = gameplay_missions_missions.getMissionById(missionId)
  end
  -- log('D', 'rallyUtil', 'getMissionName: found mission, name = ' .. tostring(mission.name))
  return mission.name
local function translatedMissionName(missionName)
  -- log('D', 'rallyUtil', 'translatedMissionName: missionName = ' .. tostring(missionName))
  if not missionName then
  local translated = translateLanguage(missionName, missionName, true)
  -- log('D', 'rallyUtil', 'translatedMissionName: translated = ' .. tostring(translated))
  return translated
local function translatedMissionNameFromId(missionId)
  -- log('D', 'rallyUtil', 'translatedMissionNameFromId: missionId = ' .. tostring(missionId))
  local missionName = getMissionName(missionId)
  local translated = translatedMissionName(missionName)
  -- log('D', 'rallyUtil', 'translatedMissionNameFromId: translated = ' .. tostring(translated))
  return translated
local function randomId()
  local randomStr = tostring(math.random(1, 1000000))
  local hash = hashStringSHA1(randomStr)
@/lua/ge/extensions/scenario/distanceGoal.lua
    if not targetobj or not instance.vId then
      log('E', 'In '..tostring(scenario.name),"there is no object called " ..instance.value.target)
      goto continue
      if instance.value.maxDistance and type(instance.value.maxDistance) ~= "number" then
        log('E', 'In '..tostring(scenario.name), ' maxDistance must contain number value')
        goto continue
      if instance.value.distanceEnable and type(instance.value.distanceEnable) ~= "number" then
        log('E', 'In '..tostring(scenario.name), ' distanceEnable must contain number value')
        goto continue
      if instance.value.minDistance and type(instance.value.minDistance) ~= "number" then
        log('E', 'In '..tostring(scenario.name), ' minDistance must contain number value')
        goto continue
      if instance.value.purpose and type(instance.value.purpose)~="string" then
        log('E', 'In '..tostring(scenario.name),'purpose is missing in json file or purpose has wrong type ')
        goto continue
@/lua/ge/extensions/util/richPresence.lua
    if extensions.core_gamestate.state.state then
      msg = msg.. " " ..tostring((core_gamestate.state.state:gsub("^%l", string.upper)) )
    end
local function set(v)
  log("D","Rich Presence", tostring(v))
  if OnlineServiceProvider then
  if OnlineServiceProvider then
    return OnlineServiceProvider.setRichPresence('b', tostring(v))
  end
@/lua/common/libs/luamqtt/mqtt/protocol5.lua
		for name, value in pairs(args.properties) do
			assert(type(name) == "string", "expecting property name to be a string: "..tostring(name))
			-- detect property identifier and check it's allowed for that packet type
			-- detect property identifier and check it's allowed for that packet type
			local prop_id = assert(properties[name], "unknown property: "..tostring(name))
			assert(prop_id ~= uprop_id, "user properties should be passed in .user_properties table")
			if not ok then
				error("invalid property value: "..name.." = "..tostring(value)..": "..tostring(val))
			end
			if not ok then
				error("invalid property value: "..name.." = "..tostring(value)..": "..tostring(val))
			end
	local uprop_id = properties.user_property
	local allowed = assert(allowed_properties[ptype], "no allowed properties for specified packet type: "..tostring(ptype))
	local props_end = input[1] + len
	else
		return false, "unexpected packet type received: "..tostring(ptype)
	end
@/lua/ge/extensions/tech/sensors.lua
  local binary = getCameraData(sensorId)
  local colourData, cData = {}, tostring(binary.colour)
  for i = 1, #cData do
  end
  local annotationData, aData = {}, tostring(binary.annotation)
  for i = 1, #aData do
  end
  local depthData, dData = {}, tostring(binary.depth)
  for i = 1, #dData, 4 do
  if not fileRef then
    log('E', 'sensors', 'ERROR - user .lua file not found at the given path: ' .. tostring(filename))
  end
local function getLidarDataPositions(sensorId)
  local pts = tostring(getLidarPointCloud(sensorId))
  local pointsData = {}
  end
  local colourBinary = tostring(getLidarColourData(sensorId))
  local colourData = {}
@/lua/ge/extensions/tech/impactgen/crashOutput.lua

  other:queueLuaCommand('input.event("throttle", ' .. tostring(throttle) .. ', 1)')

  other:queueLuaCommand('input.event("throttle", ' .. tostring(throttle) .. ', 1)')
  if throttle > 0 then
    ego:queueLuaCommand('input.event("throttle", ' ..  tostring(throttle) .. ', 1)')
  else
  else
    ego:queueLuaCommand('input.event("brake", ' ..  tostring(-throttle) .. ', 1)')
  end
@/lua/ge/extensions/editor/tech/roadArchitect/roads.lua
      roadMeshMgr.tryRemoveBridge(road.name)
      local folder = scenetree.findObject("Road Architect - Bridge " .. tostring(road.name))
      if folder then
      if r.isBridge then
        local folder = scenetree.findObject("Road Architect - Bridge " .. tostring(r.name))
        if not folder then
          folder = createObject("SimGroup")
          folder:registerObject("Road Architect - Bridge " .. tostring(r.name))
          scenetree.MissionGroup:addObject(folder)
      roadMeshMgr.tryRemoveBridge(road.name)
      local folder = scenetree.findObject("Road Architect - Bridge " .. tostring(road.name))
      if folder then
      rGroups[i] = createObject("SimGroup")
      rGroups[i]:registerObject("Road Architect - Road " .. tostring(i))
      scenetree.MissionGroup:addObject(rGroups[i])
    if not roads[i].isBridge then
      local folder = scenetree.findObject("Road Architect - Road " .. tostring(i))
      if folder then
    if w then
      local iS = tostring(i)
      serWidths[iS], serHeightsL[iS], serHeightsR[iS] = w[0], heightsL[i][0], heightsR[i][0]
  for i = -20, 20 do
    local iS = tostring(i)
    local w = serWidths[iS]
@/lua/ge/extensions/flowgraph/nodes/ui/flashMessage.lua
  if type(msg) ~= 'table' then
    msg = tostring(msg)
  end
@/lua/ge/extensions/flowgraph/nodes/gameplay/dragRace/dragTimes.lua
  if not timerData then
    local errorMsg = string.format("Timer data not found for vehicle ID: %s. Vehicle may not be part of the drag race.", tostring(vehId))
    self:__setNodeError('timers', errorMsg)
@/lua/ge/extensions/editor/api/roadRiver.lua
  else
    road:setField("overObjects", 0, tostring(roadInfo.overObjects))
  end
@/lua/ge/extensions/gameplay/traffic/baseRole.lua
  else
    log('E', 'traffic', 'Traffic role action not found: '..tostring(name))
  end
@/lua/ge/extensions/tech/openDriveExporter.lua
    -- Road header data.
    f:write('\n')
    -- Road header data.
    f:write('\n')
    -- Road header data.
    f:write('\n')
    if r['predecessor'] ~= 'none' then
      f:write('\n')
    end
    if r['predecessor'] ~= 'none' then
      f:write('\n')
    end
    if r['successor'] ~= 'none' then
      f:write('\n')
    end
    if r['successor'] ~= 'none' then
      f:write('\n')
    end
    -- Geometry data.
    local Au, Bu, Cu, Du = tostring(r['refLineCubic']['uA']), tostring(r['refLineCubic']['uB']), tostring(r['refLineCubic']['uC']), tostring(r['refLineCubic']['uD'])
    local Av, Bv, Cv, Dv = tostring(r['refLineCubic']['vA']), tostring(r['refLineCubic']['vB']), tostring(r['refLineCubic']['vC']), tostring(r['refLineCubic']['vD'])
    -- Geometry data.
    local Au, Bu, Cu, Du = tostring(r['refLineCubic']['uA']), tostring(r['refLineCubic']['uB']), tostring(r['refLineCubic']['uC']), tostring(r['refLineCubic']['uD'])
    local Av, Bv, Cv, Dv = tostring(r['refLineCubic']['vA']), tostring(r['refLineCubic']['vB']), tostring(r['refLineCubic']['vC']), tostring(r['refLineCubic']['vD'])
    -- Geometry data.
    local Au, Bu, Cu, Du = tostring(r['refLineCubic']['uA']), tostring(r['refLineCubic']['uB']), tostring(r['refLineCubic']['uC']), tostring(r['refLineCubic']['uD'])
    local Av, Bv, Cv, Dv = tostring(r['refLineCubic']['vA']), tostring(r['refLineCubic']['vB']), tostring(r['refLineCubic']['vC']), tostring(r['refLineCubic']['vD'])
    -- Geometry data.
    local Au, Bu, Cu, Du = tostring(r['refLineCubic']['uA']), tostring(r['refLineCubic']['uB']), tostring(r['refLineCubic']['uC']), tostring(r['refLineCubic']['uD'])
    local Av, Bv, Cv, Dv = tostring(r['refLineCubic']['vA']), tostring(r['refLineCubic']['vB']), tostring(r['refLineCubic']['vC']), tostring(r['refLineCubic']['vD'])
    local Au, Bu, Cu, Du = tostring(r['refLineCubic']['uA']), tostring(r['refLineCubic']['uB']), tostring(r['refLineCubic']['uC']), tostring(r['refLineCubic']['uD'])
    local Av, Bv, Cv, Dv = tostring(r['refLineCubic']['vA']), tostring(r['refLineCubic']['vB']), tostring(r['refLineCubic']['vC']), tostring(r['refLineCubic']['vD'])
    f:write('\n')
    local Au, Bu, Cu, Du = tostring(r['refLineCubic']['uA']), tostring(r['refLineCubic']['uB']), tostring(r['refLineCubic']['uC']), tostring(r['refLineCubic']['uD'])
    local Av, Bv, Cv, Dv = tostring(r['refLineCubic']['vA']), tostring(r['refLineCubic']['vB']), tostring(r['refLineCubic']['vC']), tostring(r['refLineCubic']['vD'])
    f:write('\n')
    local Au, Bu, Cu, Du = tostring(r['refLineCubic']['uA']), tostring(r['refLineCubic']['uB']), tostring(r['refLineCubic']['uC']), tostring(r['refLineCubic']['uD'])
    local Av, Bv, Cv, Dv = tostring(r['refLineCubic']['vA']), tostring(r['refLineCubic']['vB']), tostring(r['refLineCubic']['vC']), tostring(r['refLineCubic']['vD'])
    f:write('\n')
    local Au, Bu, Cu, Du = tostring(r['refLineCubic']['uA']), tostring(r['refLineCubic']['uB']), tostring(r['refLineCubic']['uC']), tostring(r['refLineCubic']['uD'])
    local Av, Bv, Cv, Dv = tostring(r['refLineCubic']['vA']), tostring(r['refLineCubic']['vB']), tostring(r['refLineCubic']['vC']), tostring(r['refLineCubic']['vD'])
    f:write('\n')
    f:write('\n')
    f:write('\n')
    f:write('\n')
    -- Elevation data.
    local Ae, Be, Ce, De = tostring(r['elevCubic']['a']), tostring(r['elevCubic']['b']), tostring(r['elevCubic']['c']), tostring(r['elevCubic']['d'])
    f:write('\n')
    -- Elevation data.
    local Ae, Be, Ce, De = tostring(r['elevCubic']['a']), tostring(r['elevCubic']['b']), tostring(r['elevCubic']['c']), tostring(r['elevCubic']['d'])
    f:write('\n')
    -- Elevation data.
    local Ae, Be, Ce, De = tostring(r['elevCubic']['a']), tostring(r['elevCubic']['b']), tostring(r['elevCubic']['c']), tostring(r['elevCubic']['d'])
    f:write('\n')
    -- Elevation data.
    local Ae, Be, Ce, De = tostring(r['elevCubic']['a']), tostring(r['elevCubic']['b']), tostring(r['elevCubic']['c']), tostring(r['elevCubic']['d'])
    f:write('\n')
    -- Road lane data.
    local Aw, Bw, Cw, Dw = tostring(r['widthCubic']['a']), tostring(r['widthCubic']['b']), tostring(r['widthCubic']['c']), tostring(r['widthCubic']['d'])
    f:write('\n')
    -- Road lane data.
    local Aw, Bw, Cw, Dw = tostring(r['widthCubic']['a']), tostring(r['widthCubic']['b']), tostring(r['widthCubic']['c']), tostring(r['widthCubic']['d'])
    f:write('\n')
    -- Road lane data.
    local Aw, Bw, Cw, Dw = tostring(r['widthCubic']['a']), tostring(r['widthCubic']['b']), tostring(r['widthCubic']['c']), tostring(r['widthCubic']['d'])
    f:write('\n')
    -- Road lane data.
    local Aw, Bw, Cw, Dw = tostring(r['widthCubic']['a']), tostring(r['widthCubic']['b']), tostring(r['widthCubic']['c']), tostring(r['widthCubic']['d'])
    f:write('\n')
  for jid, j in pairs(junctions) do
    f:write('\n')
    local ctr = 0
        if i1 ~= i2 then
          f:write('\n')
          if ra['contactPoint'] == 'start' and rb['contactPoint'] == 'start' then
        if i1 ~= i2 then
          f:write('\n')
          if ra['contactPoint'] == 'start' and rb['contactPoint'] == 'start' then
        if i1 ~= i2 then
          f:write('\n')
          if ra['contactPoint'] == 'start' and rb['contactPoint'] == 'start' then
        if i1 ~= i2 then
          f:write('\n')
          if ra['contactPoint'] == 'start' and rb['contactPoint'] == 'start' then
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamModifierLeakVis.lua

      local id1 = tostring(n1.name or n1.cid)
      local id2 = tostring(n2.name or n2.cid)
      local id1 = tostring(n1.name or n1.cid)
      local id2 = tostring(n2.name or n2.cid)
  if not valid then
    --log('E', '', sectionName .. "[" .. currCount .. "]." .. mod .. " ~= " .. tostring(vehDataModVal))
    log('E', '', sectionName .. "[" .. currCount .. "] wrong")
      local vStr = nil
      if type(v) == "string" then vStr = '"' .. v .. '"' else vStr = tostring(v) end
      str = str .. '' .. k .. ' = ' .. vStr
      local vStr = nil
      if type(v) == "string" then vStr = '"' .. v .. '"' else vStr = tostring(v) end
      str = str .. vStr
                else
                  modValStr = tostring(modVal)
                end
@/gameplay/missions/automation_test_track/flowgraph/001-Dam/customNodes/getClosestStaticObjectNode.lua
  for _, obj in ipairs(getObjectsByClass("TSStatic") or {}) do
    if not internalName or internalName == tostring(obj:getInternalName()) then
      if not shapeName or string.endswith(obj.shapeName, shapeName) then
@/lua/ge/extensions/editor/dynamicDecals/widgets.lua
    for i = baseProp.min, baseProp.max do
      options = options .. tostring(i) .. "\0"
    end
@/lua/ge/extensions/editor/flowgraph/missionVariableHelper.lua

  log("D", logTag, "Selected mission: " .. tostring(selectedMission.id))
        injected = injected + 1
        log("D", logTag, string.format("  [#] %s -> injected player vehicle ID = %s", varName, tostring(vehicleId)))
      end
@/lua/common/libs/lua-websockets/websocket/frame.lua
    if reason then
      data = data..tostring(reason)
    end
@/lua/ge/extensions/editor/gen/render.lua
	for _,pos in pairs(set) do
--			print('?? set:'..tostring(pos)..':'..tostring(campos)..':'..tostring(c))
		local r = w*math.sqrt((pos-campos):length())
	for _,pos in pairs(set) do
--			print('?? set:'..tostring(pos)..':'..tostring(campos)..':'..tostring(c))
		local r = w*math.sqrt((pos-campos):length())
	for _,pos in pairs(set) do
--			print('?? set:'..tostring(pos)..':'..tostring(campos)..':'..tostring(c))
		local r = w*math.sqrt((pos-campos):length())
	for _,s in pairs(list) do
--			print('?? label:'..tostring(s[2])..':'..tostring(s[1]))
		debugDrawer:drawText(s[2], String(tostring(s[1])), c)
	for _,s in pairs(list) do
--			print('?? label:'..tostring(s[2])..':'..tostring(s[1]))
		debugDrawer:drawText(s[2], String(tostring(s[1])), c)
--			print('?? label:'..tostring(s[2])..':'..tostring(s[1]))
		debugDrawer:drawText(s[2], String(tostring(s[1])), c)
	end
local function circle(center, r, c, w, dd)
--        print('?? circle:'..tostring(center))
	if not w then w = 1 end
		end
--        print('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
		end
--        print('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
		end
--        print('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
		end
--        print('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
		end
--        print('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
		end
--        print('?? for_i:'..tostring(i)..tostring(center)..'::'..tostring(r)..' dv='..tostring(dv)..' v='..tostring(v)..tostring(v+dv))
		v = v + dv
@/lua/ge/extensions/flowgraph/nodes/vehicle/beamstate/beamstate.lua
  builder:Middle()
  im.Text(tostring(self.selected))
end
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/directlyTo.lua

  veh:queueLuaCommand('ai:scriptStop('..tostring(self.data.handBrakeWhenFinished)..','..tostring(self.data.straightenWheelsWhenFinished)..')')
end

  veh:queueLuaCommand('ai:scriptStop('..tostring(self.data.handBrakeWhenFinished)..','..tostring(self.data.straightenWheelsWhenFinished)..')')
end
  builder:Middle()
  im.Text("Complete " .. tostring(self.complete))
  im.Text("Started " .. tostring(self.started))
  im.Text("Complete " .. tostring(self.complete))
  im.Text("Started " .. tostring(self.started))
  --debugDrawer:drawSphere(self.position, 0.25, self.markerColor)
@/lua/ge/extensions/career/modules/insurance/insurance.lua
    hasVehicles = true
    local vehCoverageOptions = potentialVehiclesCoverageOptions and potentialVehiclesCoverageOptions[tostring(invVehData.id)]
    local vehPremium = calculateVehiclePremium(invVehData.id, nil, vehCoverageOptions)
@/lua/ge/extensions/freeroam/freeroam.lua
  if M.spawningOptionsHelper.timeOfDay ~= "default" then
    log('I', logTag, 'Setting time of day to: ' .. tostring(M.spawningOptionsHelper.timeOfDay))
    local time = M.spawningOptionsHelper.timeOfDay
      if timeValue then
        log('I', logTag, 'Time of day found: ' .. tostring(timeValue))
        time = timeValue
      else
        log('W', logTag, 'Time of day key not found: ' .. tostring(time))
        time = nil
    if type(time) == 'number' then
      log('I', logTag, 'Setting time of day to: ' .. tostring(time))
      core_environment.setTimeOfDay({time = time})
   if M.spawningOptionsHelper.timePlay and M.spawningOptionsHelper.timePlay ~= "disabled" then
     log('I', logTag, 'Setting time progression to: ' .. tostring(M.spawningOptionsHelper.timePlay))
    if not level then
      log('E', logTag, 'Level not found: ' .. tostring(levelName))
      return
@/lua/common/utils/perf.lua
  for _,vv in ipairs(d.fcts) do
    f:write(vv.f .. ', ' .. tostring(vv.s) .. "\n")
  end
@/lua/ge/extensions/editor/rallyEditor/static.lua
    for i,variant in ipairs(variants) do
      im.Text(name..'_'..tostring(i))
      im.NextColumn()

      im.Text(tostring(variant.weight or 'auto'))
      im.NextColumn()

  --     im.Text(tostring(spn.metadata.weight or 'auto'))
  --     im.NextColumn()
@/lua/ge/extensions/flowgraph/nodes/vehicle/special/vehicleAction.lua
function C:formatCommand(cmd)
  local c = cmd:gsub("VALUE",tostring(self.pinIn.val.value or 0))
  c = c:gsub("FILTERTYPE",tostring(self.pinIn.inputFilter.value or 0))
  local c = cmd:gsub("VALUE",tostring(self.pinIn.val.value or 0))
  c = c:gsub("FILTERTYPE",tostring(self.pinIn.inputFilter.value or 0))
  c = c:gsub("ANGLE",tostring(self.pinIn.angle.value or 0))
  c = c:gsub("FILTERTYPE",tostring(self.pinIn.inputFilter.value or 0))
  c = c:gsub("ANGLE",tostring(self.pinIn.angle.value or 0))
  return c
@/lua/ge/extensions/core/vehicles.lua
      log('W', '', 'Info file '..filepath..' has a non-string value for key '..key..': '..dumps(value)..'('..type(value)..'). Converting to string.')
      newData[key] = tostring(value)
    end
      if type(value) == "string" then
        newData[key] = tostring(value)
        if newData[key] == nil then
            if jbeamFilesCount == 0 then
              log('W', '', 'standalone pc file without any jbeam files ignored: ' .. tostring(path))
              --- comment this out to see all standalone pc files
          else
            log('W', '', 'standalone pc file without info file ignored: ' .. tostring(path))
            if not _showInvalidPcFiles then
            if not modelsData[model]['info'][infoFilename] then
              --log('W', '', 'Vehicle config does not have an info file: ' .. tostring(path) .. '. Ignoring the file.')
              addIt = false
      if #jbeamFiles == 0 then
        log('W', '', 'Warning: vehicle folder does not contain any jbeam files: ' .. tostring(path) .. '. Ignored.')
        goto continue
      if not mainPartFound then
        log('W', '', 'Warning: vehicle folder does not contain a configuration or a valid main part: ' .. tostring(path))
        goto continue
      end
      log('W', '', 'Warning: vehicle folder containing main part but no info or config: ' .. tostring(path))
      -- adding the model anyways so the default configuration is spawn-able
  if not vehFiles then
    log('E', '', 'Vehicle not available: ' .. tostring(key))
    return nil
    if not FS:fileExists(filename) then
      filename = '/vehicles/' .. tostring(modelName) .. '/' .. tostring(opts.config)
    end
    if not FS:fileExists(filename) then
      filename = '/vehicles/' .. tostring(modelName) .. '/' .. tostring(opts.config)
    end
    if content ~= nil then
      log("D","makeVehicleLicenseText","forced to used LicencePlate.txt = '"..tostring(content).."'")
      return content
    if levelName then
      -- log('E', 'setPlateText', "levelName = "..tostring(levelName))
      designPath =  'vehicles/common/licenseplates/'..levelName..'/licensePlate-default.json'
        if curFormat ~= "52-11" or designPath ~= DEFAULT_DESIGN_PATH then
          log("W", "setPlateText", "license plate format not found '"..tostring(curFormat).."' in style '"..tostring(designPath).."'")
        end
        if curFormat ~= "52-11" or designPath ~= DEFAULT_DESIGN_PATH then
          log("W", "setPlateText", "license plate format not found '"..tostring(curFormat).."' in style '"..tostring(designPath).."'")
        end
            designData.data = defaultDesign.data.format[curFormat]
            log("I", "setPlateText", "license plate fallback used '"..tostring(defaultDesignFallBackPath).."'")
          else
          else
            log('E',tostring(defaultDesignFallBackPath) , 'Json error')
            goto continue
        else
          log('E', "setPlateText", '[NO TEXTURE] No fallback for this licence plate format. Please create a default file here : "'..tostring(defaultDesignFallBackPath)..'"')
          goto continue
        else
          log('E',tostring(designData.data.characterLayout) , ' File not existing')
        end
        else
          log('E',tostring(designData.data.generator) , ' File not existing')
        end

      -- log('D', "setPlateText", "cef tex :"..tostring(curFormat).. "   gen="..tostring(designData.data.generator) .. "prefix="..tostring(textureTagPrefix) )
      veh:createUITexture(textureTagPrefix, designData.data.generator, designData.data.size.x, designData.data.size.y, UI_TEXTURE_USAGE_AUTOMATIC, 1) --UI_TEXTURE_USAGE_MANUAL

      -- log('D', "setPlateText", "cef tex :"..tostring(curFormat).. "   gen="..tostring(designData.data.generator) .. "prefix="..tostring(textureTagPrefix) )
      veh:createUITexture(textureTagPrefix, designData.data.generator, designData.data.size.x, designData.data.size.y, UI_TEXTURE_USAGE_AUTOMATIC, 1) --UI_TEXTURE_USAGE_MANUAL

      -- log('D', "setPlateText", "cef tex :"..tostring(curFormat).. "   gen="..tostring(designData.data.generator) .. "prefix="..tostring(textureTagPrefix) )
      veh:createUITexture(textureTagPrefix, designData.data.generator, designData.data.size.x, designData.data.size.y, UI_TEXTURE_USAGE_AUTOMATIC, 1) --UI_TEXTURE_USAGE_MANUAL
@/lua/ge/extensions/ui/bindingsLegend.lua
    im.Text("Delay Timer: " .. string.format("%.2f", fadeDelayTimer))
    im.Text("VehicleSpecific visible: " .. tostring(actionCategoryActive["vehicleSpecific"]))
    im.Text("Should fade:   " .. tostring(shouldFade()))
    im.Text("VehicleSpecific visible: " .. tostring(actionCategoryActive["vehicleSpecific"]))
    im.Text("Should fade:   " .. tostring(shouldFade()))
    im.Text("Is faded:      " .. tostring(isFaded))
    im.Text("Should fade:   " .. tostring(shouldFade()))
    im.Text("Is faded:      " .. tostring(isFaded))
@/lua/ge/extensions/scenario/raceUI.lua
  local curTime = string.format("%.3f", data.time) .. 's'
  --guihooks.trigger('ScenarioFlashMessage', {{'Lap ' ..tostring(data.lap) .. ' time: ' .. curTime, 3}} )
  ui_message('lap ' ..tostring(data.lap) .. ' time: '..curTime, 2)
  --guihooks.trigger('ScenarioFlashMessage', {{'Lap ' ..tostring(data.lap) .. ' time: ' .. curTime, 3}} )
  ui_message('lap ' ..tostring(data.lap) .. ' time: '..curTime, 2)
end
@/lua/ge/extensions/gameplay/drag/dragBridge.lua

  log('E', logTag, 'Failed to load drag strip: ' .. tostring(dragStripId))
  return nil
  if not vehicleDetails then
    log("E", logTag, "Could not find vehicle details for ID: " .. tostring(vehId))
    return
  if not data then
    log("E", logTag, "Failed to load drag data from file: " .. tostring(filepath))
    return
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamVariablesChecker.lua
    if ok == false then
      log('E', "jbeam.parseFile","unable to decode JSON: "..tostring(filename))
      log('E', "jbeam.parseFile","JSON decoding error: "..tostring(data))
      log('E', "jbeam.parseFile","unable to decode JSON: "..tostring(filename))
      log('E', "jbeam.parseFile","JSON decoding error: "..tostring(data))
      return nil
  else
    log('E', "jbeam.parseFile","unable to read file: "..tostring(filename))
  end
  if valBeforeClamp ~= vv.val then
    log('W', '', 'variable ' .. tostring(vv.name) .. ' value out of range! value ' .. tostring(valBeforeClamp) .. ' clamped to range [' .. tostring(vv.min) .. ',' .. tostring(vv.max) .. '] as ' .. tostring(vv.val))
    log('W', '', '  var defined: ' .. varDefFilename .. ':' .. partName)
  if valBeforeClamp ~= vv.val then
    log('W', '', 'variable ' .. tostring(vv.name) .. ' value out of range! value ' .. tostring(valBeforeClamp) .. ' clamped to range [' .. tostring(vv.min) .. ',' .. tostring(vv.max) .. '] as ' .. tostring(vv.val))
    log('W', '', '  var defined: ' .. varDefFilename .. ':' .. partName)
  if valBeforeClamp ~= vv.val then
    log('W', '', 'variable ' .. tostring(vv.name) .. ' value out of range! value ' .. tostring(valBeforeClamp) .. ' clamped to range [' .. tostring(vv.min) .. ',' .. tostring(vv.max) .. '] as ' .. tostring(vv.val))
    log('W', '', '  var defined: ' .. varDefFilename .. ':' .. partName)
  if valBeforeClamp ~= vv.val then
    log('W', '', 'variable ' .. tostring(vv.name) .. ' value out of range! value ' .. tostring(valBeforeClamp) .. ' clamped to range [' .. tostring(vv.min) .. ',' .. tostring(vv.max) .. '] as ' .. tostring(vv.val))
    log('W', '', '  var defined: ' .. varDefFilename .. ':' .. partName)
  if valBeforeClamp ~= vv.val then
    log('W', '', 'variable ' .. tostring(vv.name) .. ' value out of range! value ' .. tostring(valBeforeClamp) .. ' clamped to range [' .. tostring(vv.min) .. ',' .. tostring(vv.max) .. '] as ' .. tostring(vv.val))
    log('W', '', '  var defined: ' .. varDefFilename .. ':' .. partName)
@/lua/ge/extensions/campaign/exploration.lua
local function openShortLocationInfo(locationKey)
  log('I', logTag, 'openShortLocationInfo called....'..tostring(locationKey))
  local campaign = campaign_campaigns.getCampaign()
      else
        log('E', logTag, 'Trigger missing for scenario : '..k..' Trigger name: '..tostring(v.entryMarker) )
      end
  if state.pendingSpawningData then
    log('D', logTag, 'onClientStartMission called....with sectionName '..tostring(state.pendingSpawningData.subsectionKey))
    local tempData = state.pendingSpawningData
local function startSubsectionExploration(subsectionKey, locationMarker, spawningData)
  log('D', logTag, 'startSubsectionExploration called ' .. tostring(subsectionKey)..', '..tostring(locationMarker))
local function startSubsectionExploration(subsectionKey, locationMarker, spawningData)
  log('D', logTag, 'startSubsectionExploration called ' .. tostring(subsectionKey)..', '..tostring(locationMarker))
  local loadedMissionFile = string.lower(getMissionFilename())
  -- log('D', logTag, 'levelMissionFile: ' .. tostring(levelMissionFile)..'   loadedMissionFile: ' .. tostring(loadedMissionFile))
  local loadedMissionFile = string.lower(getMissionFilename())
  -- log('D', logTag, 'levelMissionFile: ' .. tostring(levelMissionFile)..'   loadedMissionFile: ' .. tostring(loadedMissionFile))
local function locationRequiresExtraUI(locationKey)
  -- log('I', logTag, 'locationRequiresExtraUI called '..tostring(locationKey))
      if not raceLevel then
        log('E', logTag, 'Could not find time trail level '..tostring(locationInfo.levelName)..' for campaign scenario '..tostring(locationKey))
        return
      if not raceLevel then
        log('E', logTag, 'Could not find time trail level '..tostring(locationInfo.levelName)..' for campaign scenario '..tostring(locationKey))
        return
    if not state.locationInfoDisplayed then
      log('I', logTag, 'Displaying mission info for '..tostring(state.locationKey))
      else
        log('E', logTag, 'could not find mission info for '..tostring(state.locationKey or nil))
      end
      else
        log('W', logTag, 'No callback set to handle trigger case for Location: '..tostring(state.locationKey))
      end
  uiParams.level = subsection.level or ""
  uiParams.money = '$'..tostring(core_inventory.getItem('$$$_MONEY',  0))
  uiParams.baseImg = minimap.image
    local playerId = be:getPlayerVehicleID(0)
    log('I', logTag, 'Updating for spawned vehicle. PlayerID: '..playerId..' Spawned: '..tostring(M.recentlySpawnedVehicle))
  local state = M.state
  -- log('I', logTag, 'Ui state changed - cur State: '..curUIState..'  prev State: '..prevUIState..'  state.locationKey: '..tostring(state.locationKey))
  if getExplorationActive() and state.locationKey and state.inSideMissionTrigger and state.missionExtraUiOpened then
@/lua/ge/extensions/gameplay/rally/recce/drivelineRecording.lua
  if #rawPoints < 3 then
    log('E', logTag, 'failed to load driveline, not enough points (points='..tostring(#rawPoints)..')')
    return nil

  log('I', logTag, 'loaded driveline in '.. string.format("%.3f", t_load)..'s with '..tostring(#rawPoints)..' points')
@/lua/ge/extensions/gameplay/rally/notebook/test/testNotebook.lua
    message = message or "assertion failed"
    log('E', logTag, string.format("%s: expected '%s' but got '%s'", message, tostring(expected), tostring(actual)))
    error("test failed: "..message)
    message = message or "assertion failed"
    log('E', logTag, string.format("%s: expected '%s' but got '%s'", message, tostring(expected), tostring(actual)))
    error("test failed: "..message)
@/lua/ge/extensions/flowgraph/nodes/ui/imgui/elemental/imText.lua
  im.PushTextWrapPos(avail.x)
  im.TextWrapped(tostring(self.pinIn.text.value))
  im.PopTextWrapPos()
@/lua/ge/extensions/editor/inspector.lua

  local wndName = inspectorWindowNamePrefix .. tostring(idx)
  editor.registerWindow(wndName, imgui.ImVec2(300, 500))
local function closeInspectorInstance(idx)
  local wndName = inspectorWindowNamePrefix .. tostring(idx)
  editor.unregisterWindow(wndName)
  if tableSize(valueInspector.selectedIds) > 1 then
    imgui.Text(tostring(tableSize(valueInspector.selectedIds)) .. " selected object(s)")
  end
  else
    editor.logError("Object with this ID does not exists in the scene: " .. tostring(valueInspector.selectedIds[1]))
    return
                local value = editor.getFieldValue(valueInspector.selectedIds[#valueInspector.selectedIds], val.name, i)
                valueInspector:valueEditorGui(val.name, value or "", i, fieldLabel .. "["..tostring(i).."]", val.fieldDocs, val.type, val.typeName, val, pasteFieldValue, nil, valueInspector.differentValuesFieldFlags[val.name] or 0)
              end
            imgui.PushID1(val.arrayName .. "_ARRAY_ITEMS_" .. i)
            if imgui.CollapsingHeader1("[" .. tostring(i) .. "]", nodeFlags) then
              for _, arrayField in ipairs(val.sortedFields) do
          imgui.SameLine()
          imgui.TextUnformatted("ID:") imgui.SameLine() imgui.TextColored(textColor, tostring(obj:getId()))
          imgui.SameLine()
          if imgui.Button("Copy ID") then
            setClipboard(tostring(obj:getId()))
          end
          if grp then
            imgui.TextUnformatted("Parent:") imgui.SameLine() imgui.TextColored(textColor, tostring(grp:getName()))
          end

          imgui.TextUnformatted("Type ".."[".. tostring(groundCoverUVTypeIndex) .."]")
          imgui.SetCursorPosX(cursorPos.x + uvValueWidgetWidth + 2*imgui.GetStyle().FramePadding.x)
          editor.uiInputFloat("##input" .. tostring(typeIndex).."U", groundCoverUVal, 0.1, 1.0, "%0.5f", imgui.InputTextFlags_EnterReturnsTrue)
          imgui.SetCursorPosX(cursorPos.x + uvValueWidgetWidth + 2*imgui.GetStyle().FramePadding.x)
          editor.uiInputFloat("##input" .. tostring(typeIndex).."V", groundCoverVVal, 0.1, 1.0, "%0.5f", imgui.InputTextFlags_EnterReturnsTrue)
          imgui.SetCursorPosX(cursorPos.x + uvValueWidgetWidth + 2*imgui.GetStyle().FramePadding.x)
          editor.uiInputFloat("##input" .. tostring(typeIndex).."W", groundCoverWVal, 0.1, 1.0, "%0.5f", imgui.InputTextFlags_EnterReturnsTrue)
          imgui.SetCursorPosX(cursorPos.x + uvValueWidgetWidth + 2*imgui.GetStyle().FramePadding.x)
          editor.uiInputFloat("##input" .. tostring(typeIndex).."H", groundCoverHVal, 0.1, 1.0, "%0.5f", imgui.InputTextFlags_EnterReturnsTrue)
        local fieldVal =
        tostring(groundCoverUVal[0]) .. " " .. tostring(groundCoverVVal[0]) .. " " .. tostring(groundCoverWVal[0] .. " " .. tostring(groundCoverHVal[0]))
        if(fieldVal ~= retTbl.fieldVal) then
        local fieldVal =
        tostring(groundCoverUVal[0]) .. " " .. tostring(groundCoverVVal[0]) .. " " .. tostring(groundCoverWVal[0] .. " " .. tostring(groundCoverHVal[0]))
        if(fieldVal ~= retTbl.fieldVal) then
        local fieldVal =
        tostring(groundCoverUVal[0]) .. " " .. tostring(groundCoverVVal[0]) .. " " .. tostring(groundCoverWVal[0] .. " " .. tostring(groundCoverHVal[0]))
        if(fieldVal ~= retTbl.fieldVal) then
        local fieldVal =
        tostring(groundCoverUVal[0]) .. " " .. tostring(groundCoverVVal[0]) .. " " .. tostring(groundCoverWVal[0] .. " " .. tostring(groundCoverHVal[0]))
        if(fieldVal ~= retTbl.fieldVal) then
  for key, val in pairs(guiInstancer.instances) do
    editor.registerWindow(inspectorWindowNamePrefix .. tostring(key), imgui.ImVec2(300, 500))
    val.fieldNameFilter = imgui.ImGuiTextFilter()
@/lua/ge/extensions/scenario/busdriver.lua
  if currentLine == nil then
    fail('Failed to load the line data for '..tostring(busConfig.routeID).."  "..tostring(busConfig.variance))
  end  --core_busRouteManager.onAtStop({cur=1,next=2,vehicleId=playerVehicleID})
  if currentLine == nil then
    fail('Failed to load the line data for '..tostring(busConfig.routeID).."  "..tostring(busConfig.variance))
  end  --core_busRouteManager.onAtStop({cur=1,next=2,vehicleId=playerVehicleID})
        if mk == nil then
          log('I', logTag,'Creating marker '..tostring(v))
          mk = createBusMarker(v)
      if (not stopComplete or stopTimer < timeToWaitAtStop) then
        -- fail("you didn't wait !!! timer="..tostring(stopTimer))
        exitTggBeforeTimer = true
    if currentLine == nil then
      fail('Failed to load the line data for '..tostring(busConfig.routeID).."  "..tostring(busConfig.variance))
    end
    if currentLine == nil then
      fail('Failed to load the line data for '..tostring(busConfig.routeID).."  "..tostring(busConfig.variance))
    end
    for _,m in ipairs(markers) do
      m:setField('instanceColor', 0, (setpointAlphaMarker ==0 and '0 1 0 ' or '1 0 0 ')..tostring(currentAlphaMarker))
    end
      core_camera.setByName(0, "external", true)
      guihooks.trigger('ScenarioRealtimeDisplay', {msg = "scenarios.busRoutes.wait", context = {remaining=tostring(ceil(timeToWaitAtStop - stopTimer))}})
      if paused == false then stopTimer = stopTimer + 0.1 end
@/lua/ge/extensions/scenario/nomoveGoal.lua
      if vehicle and (instance.startPos - vehicle:getPosition()):len() > 0.1 then
        log('D', logTag, 'checkRaceGoals failed: '..instance.vehicleName..' moved '..tostring(instance.startPos)..' '..tostring( vehicle:getPosition() ) )
        if instance.value.triggerEndOnly then
      if vehicle and (instance.startPos - vehicle:getPosition()):len() > 0.1 then
        log('D', logTag, 'checkRaceGoals failed: '..instance.vehicleName..' moved '..tostring(instance.startPos)..' '..tostring( vehicle:getPosition() ) )
        if instance.value.triggerEndOnly then
@/lua/ge/extensions/editor/flowgraph/history.lua
      if i > self.mgr.currentHistoryIndex then
        im.TextColored(disabledColor,tostring(i))
        if im.IsItemClicked() then goToHistory = i end
      elseif i == self.mgr.currentHistoryIndex then
        im.Text('>' .. tostring(i))
        if im.IsItemClicked() then goToHistory = i end
      else
        im.Text(tostring(i))
        if im.IsItemClicked() then goToHistory = i end
@/lua/ge/extensions/gameplay/crawl/utils.lua
local function setupCrawlMarkers(path)
  local pathId = path._filePath or path.id or path._id or tostring(path)
  if markersVisibleForPath == pathId then
      table.insert(wps, {
        name = tostring(i),
        pos = pn.pos,
      })
      markerModes[tostring(i)] = 'hidden'
    end
  if path.nodes and #path.nodes > 0 then
    markerModes[tostring(#path.nodes)] = 'final'
  end
    if path.nodes and #path.nodes > 0 then
      markerModes[tostring(1)] = 'current'
      markers.setModes(markerModes)
  for i, _ in ipairs(pathnodes) do
    markerModes[tostring(i)] = 'inactive'
  end
  -- Set final node
  markerModes[tostring(#pathnodes)] = 'final'
      if currentPathnode.flags.isRecoveryCheckpoint then
        markerModes[tostring(currentIndex)] = 'recovery'
      -- Bonus checkpoints (purple)
      elseif currentPathnode.flags.isBonusCheckpoint then
        markerModes[tostring(currentIndex)] = 'bonus'
      else
        -- Normal next node (red)
        markerModes[tostring(currentIndex)] = 'current'
      end
      -- Normal next node (red)
      markerModes[tostring(currentIndex)] = 'current'
    end
  for pathnodeId, _ in pairs(state.completedPathnodes) do
    markerModes[tostring(pathnodeId)] = 'finished'
  end
      if not state.completedPathnodes[skippedId] then
        markerModes[tostring(skippedId)] = 'skipped'
      end
      if finalPathnode.flags.isRecoveryCheckpoint then
        markerModes[tostring(currentIndex)] = 'recovery'
      elseif finalPathnode.flags.isBonusCheckpoint then
      elseif finalPathnode.flags.isBonusCheckpoint then
        markerModes[tostring(currentIndex)] = 'bonus'
      else
      else
        markerModes[tostring(currentIndex)] = 'final'
      end
    else
      markerModes[tostring(currentIndex)] = 'final'
    end
    if state.isCompleted then
      markerModes[tostring(currentIndex)] = 'finished'
    end
@/lua/common/libs/lunajson/lunajson/encoder.lua
  local function f_tostring(v)
    builder[i] = tostring(v)
    i = i+1

  local radixmark = match(tostring(0.5), '[^0-9]')
  local delimmark = match(tostring(12345.12345), '[^0-9' .. radixmark .. ']')
  local radixmark = match(tostring(0.5), '[^0-9]')
  local delimmark = match(tostring(12345.12345), '[^0-9' .. radixmark .. ']')
  if radixmark == '.' then
@/lua/common/utils/simpleHttpServer.lua
    if err == 'closed' then return end
    log('E', 'simpleHttpServer', "client.receive error: " .. tostring(err))
    return
        if err == 'closed' then return end
        log('E', 'simpleHttpServer', "client.receive error: " .. tostring(err))
        return nil
    -- existing?
    return response_error('404 Not Found', 'File not found: ' .. tostring(fn))
  end
  if not s then
    return response_error('500 Internal Server Error', 'Internal Server Error: unable to stat file: ' .. tostring(fn))
  end
  if not mimetype then
    return response_error('500 Internal Server Error', 'Internal Server Error: unable to get mime type: ' .. tostring(fn))
  end
  for _, v in pairs(handlers) do
    --print("** " .. tostring(req.uri.path) .. ' ~= ' .. tostring(v[1]))
    local res = {string.match(req.uri.path, v[1])}
  for _, v in pairs(handlers) do
    --print("** " .. tostring(req.uri.path) .. ' ~= ' .. tostring(v[1]))
    local res = {string.match(req.uri.path, v[1])}
  {'/hello/(%d+)', function(req, res)
    return 'hello world: ' .. tostring(res[1])
  end},
@/lua/ge/extensions/gameplay/route/raceRoute.lua

  -- log('D', logTag, string.format("RaceRoute:init with removeFirst=%s useMapPathfinding=%s closeDistSquared=%s", tostring(self.removeFirst), tostring(self.useMapPathfinding), tostring(self.closeDistSquared)))

  -- log('D', logTag, string.format("RaceRoute:init with removeFirst=%s useMapPathfinding=%s closeDistSquared=%s", tostring(self.removeFirst), tostring(self.useMapPathfinding), tostring(self.closeDistSquared)))

  -- log('D', logTag, string.format("RaceRoute:init with removeFirst=%s useMapPathfinding=%s closeDistSquared=%s", tostring(self.removeFirst), tostring(self.useMapPathfinding), tostring(self.closeDistSquared)))
        -- if not string.find(p, "^DR") then
          -- log('E', '', "Waypoint ID '" .. tostring(p) .. "' does not start with 'DR'")
        -- end
          -- else
          --   log('D', '', string.format("merging last.wp=%s cur.wp=%s", tostring(last.wp), tostring(cur.wp)))
          -- end
          -- else
          --   log('D', '', string.format("merging last.wp=%s cur.wp=%s", tostring(last.wp), tostring(cur.wp)))
          -- end
      -- if stableId then
        -- msg = string.format('callbackResult=%s source="%s" stableId="%s"', tostring(callbackResult), source, stableId)
      -- else
@/lua/ge/extensions/editor/gen/test.lua
            local om = scenetree.findObjectById(tonumber(o))
                lo('?? if_DEL:'..tostring(o)..':'..tostring(om))
            if om then
            local om = scenetree.findObjectById(tonumber(o))
                lo('?? if_DEL:'..tostring(o)..':'..tostring(om))
            if om then
	local list = FS:findFiles(pth, '*.dae', -1, true, false)
--		lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ onVal_gen_unique:'..tostring(pth)..':'..tableSize(amesh))
	for i,s in pairs(list) do
	list = FS:findFiles(pth, '*.json', -1, true, false)
--		lo('?? onVal_gen_unique:'..tostring(pth)..':'..tableSize(amesh))
	for i,s in pairs(list) do
    local groupBat = scenetree.findObject('bat')
        lo('?? test.test:'..tostring(groupBat))
        if true then return end
			else
--					lo('?? for_module:'..tostring(scenetree.findObject(o)))
				scenetree.findObject(o):delete()
	local startPoint = vec3(core_camera.getPosition())
	lo('?? pretest:'..tostring(inworld)..':'..tostring(direction)..':'..tostring(startPoint)) --..':'..tostring(color(0,255,255,255).x))
	local x, y, z = -3351.02, 3728.87
	local startPoint = vec3(core_camera.getPosition())
	lo('?? pretest:'..tostring(inworld)..':'..tostring(direction)..':'..tostring(startPoint)) --..':'..tostring(color(0,255,255,255).x))
	local x, y, z = -3351.02, 3728.87
	local startPoint = vec3(core_camera.getPosition())
	lo('?? pretest:'..tostring(inworld)..':'..tostring(direction)..':'..tostring(startPoint)) --..':'..tostring(color(0,255,255,255).x))
	local x, y, z = -3351.02, 3728.87
	local startPoint = vec3(core_camera.getPosition())
	lo('?? pretest:'..tostring(inworld)..':'..tostring(direction)..':'..tostring(startPoint)) --..':'..tostring(color(0,255,255,255).x))
	local x, y, z = -3351.02, 3728.87

--            lo('?? decs:'..tostring(#rdlist))
--			local matobj = scenetree.findObject('GroundGrid2')
--			lo('?? test_if_build:'..tableSize(adesc)..':'..tableSize(levelMaterialNames)..':'..tostring(matobj))
--		local ffifound, ffi = pcall(require, 'ffi')
			local id,om = M.meshUp(am, 'tst', scenetree.findObject('edit'))
				lo('?? for_OM:'..tostring(id))
				if true then return end
				if true then return end
--				lo('?? for_OM:'..tostring(id)..':'..tostring(om))
			M.toDAE({alod[1].list[1].m}, '/tmp/test_corner.dae')
				if true then return end
--				lo('?? for_OM:'..tostring(id)..':'..tostring(om))
			M.toDAE({alod[1].list[1].m}, '/tmp/test_corner.dae')
					if ang>0 and math.abs(ang-math.pi)>0.1 then
						lo('?? for_ANG:'..i..':'..tostring(v)..':'..ang)
						am[1].verts[i] = ref + U.vturn(v-ref, math.pi/8)
			local id,om = M.meshUp(am, 'tst', scenetree.findObject('edit'))
				lo('?? for_OM:'..tostring(id))
--				U.out.aset[2] = {set=U.map(am[1].verts,function(k,v)
		end
			U.dump(aseq, '?? if_OK:'..tostring(mbody)..':'..tostring(pmi)) --..':'..#aloop)
		return
		end
			U.dump(aseq, '?? if_OK:'..tostring(mbody)..':'..tostring(pmi)) --..':'..#aloop)
		return
			end
				U.dump(desc.aspline, '?? d_ASPLINE:'..tostring(desc.id))
				-- start edit
						local wall = d.afloor[j].awall[iw]
							lo('?? for_WALL:'..iw..':'..tostring(wall.pos)..':'..tostring(d.pos)..':'..tostring(d.afloor[j].pos))
						base[#base+1] = wall.pos
						local wall = d.afloor[j].awall[iw]
							lo('?? for_WALL:'..iw..':'..tostring(wall.pos)..':'..tostring(d.pos)..':'..tostring(d.afloor[j].pos))
						base[#base+1] = wall.pos
						local wall = d.afloor[j].awall[iw]
							lo('?? for_WALL:'..iw..':'..tostring(wall.pos)..':'..tostring(d.pos)..':'..tostring(d.afloor[j].pos))
						base[#base+1] = wall.pos
			winleft = (L - (winspace*nwin + doorspace))/2
--				lo('?? for_WP:'..nwin..':'..L..'/'..l..' ws:'..winspace..':'..winleft..':'..tostring(doorind))
--			local ar,step = {},winleft
--				local lst = U.circ2seg(c,r,p1,p2,U.small_val)
--				U.dump(lst, '??*********** if_HIT:'..#lst..':'..tostring(c)..' r:'..r..'/'..c:distance(p1)..':'..c:distance(p2)..':'..tostring(p1)..':'..tostring(p2))
--				local lst = U.circ2seg(c,r,p1,p2,U.small_val)
--				U.dump(lst, '??*********** if_HIT:'..#lst..':'..tostring(c)..' r:'..r..'/'..c:distance(p1)..':'..c:distance(p2)..':'..tostring(p1)..':'..tostring(p2))
--				local lst = U.circ2seg(c,r,p1,p2,U.small_val)
--				U.dump(lst, '??*********** if_HIT:'..#lst..':'..tostring(c)..' r:'..r..'/'..c:distance(p1)..':'..c:distance(p2)..':'..tostring(p1)..':'..tostring(p2))
		local list = fdata:getItems()
			lo('?? if_frst:'..tostring(#list))
		for _,o in pairs(list) do
		for _,o in pairs(list) do
			lo('?? if_ctx:'..tostring(o:getContextID())) --..tostring(o.ctxid)..':'..tostring(o.contextID)) --o:getContextID())
		end
		for _,o in pairs(list) do
			lo('?? if_ctx:'..tostring(o:getContextID())) --..tostring(o.ctxid)..':'..tostring(o.contextID)) --o:getContextID())
		end
		for _,o in pairs(list) do
			lo('?? if_ctx:'..tostring(o:getContextID())) --..tostring(o.ctxid)..':'..tostring(o.contextID)) --o:getContextID())
		end
		for _,f in pairs(list) do
--			lo('?? for_it:'..tostring(f:getPosition()))
			f:setPosition(f:getPosition() + vec3(0,0,-1))
--			editor.removeForestItem(fdata, f)
				lo('?? for_it21:'..tostring(f:getPosition()))
		end
				om:setField('shapeName', 0, dirname..nm..'.dae')
					lo('?? for_DAE:'..tostring(om.obj)) --..':'..om.__parent)
				om:registerObject(nm) --'tmp_'..tostring(os.clock()))
					lo('?? for_DAE:'..tostring(om.obj)) --..':'..om.__parent)
				om:registerObject(nm) --'tmp_'..tostring(os.clock()))
				groupBat:add(om.obj)
		local data = file:read('*all')
--			lo('?? opened:'..tostring(file))
		file:close()
		for k,d in pairs(adesc) do
				lo('?? for_DESC:'..tostring(d.id))
--[[
		local originalMesh = scenetree.findObjectById(m:getID())
			lo('?? if_OBJ:'..tostring(inspect)..':'..tostring(m.obj)..':'..tostring(m:getID())..':'..tostring(originalMesh)) --..':'..tostring(nodes)) --..tostring(editor.getNodes(m)))
--			print('?? to_SER:'..serialize(m.obj))
		local originalMesh = scenetree.findObjectById(m:getID())
			lo('?? if_OBJ:'..tostring(inspect)..':'..tostring(m.obj)..':'..tostring(m:getID())..':'..tostring(originalMesh)) --..':'..tostring(nodes)) --..tostring(editor.getNodes(m)))
--			print('?? to_SER:'..serialize(m.obj))
		local originalMesh = scenetree.findObjectById(m:getID())
			lo('?? if_OBJ:'..tostring(inspect)..':'..tostring(m.obj)..':'..tostring(m:getID())..':'..tostring(originalMesh)) --..':'..tostring(nodes)) --..tostring(editor.getNodes(m)))
--			print('?? to_SER:'..serialize(m.obj))
		local originalMesh = scenetree.findObjectById(m:getID())
			lo('?? if_OBJ:'..tostring(inspect)..':'..tostring(m.obj)..':'..tostring(m:getID())..':'..tostring(originalMesh)) --..':'..tostring(nodes)) --..tostring(editor.getNodes(m)))
--			print('?? to_SER:'..serialize(m.obj))
		local originalMesh = scenetree.findObjectById(m:getID())
			lo('?? if_OBJ:'..tostring(inspect)..':'..tostring(m.obj)..':'..tostring(m:getID())..':'..tostring(originalMesh)) --..':'..tostring(nodes)) --..tostring(editor.getNodes(m)))
--			print('?? to_SER:'..serialize(m.obj))
		local originalMesh = scenetree.findObjectById(m:getID())
			lo('?? if_OBJ:'..tostring(inspect)..':'..tostring(m.obj)..':'..tostring(m:getID())..':'..tostring(originalMesh)) --..':'..tostring(nodes)) --..tostring(editor.getNodes(m)))
--			print('?? to_SER:'..serialize(m.obj))
			print(inspect(getmetatable(m.obj)))
--			print('??'..tostring(m.obj:getFields()))
		local fields = m.obj:getDynamicFields()
		local fields = m.obj:getDynamicFields()
			lo('?? sdf:'..tostring(m.obj:getStaticDataFieldbyIndex(1, 1)))
		for k,f in pairs(fields) do
		for k,f in pairs(fields) do
			lo('?? fof:'..tostring(k)..':'..tostring(f))
		end
		for k,f in pairs(fields) do
			lo('?? fof:'..tostring(k)..':'..tostring(f))
		end
--		local lastMeshInfo = GPUMesh.bng_getGPUMesh(m:getID())
--			lo('?? if_LM:'..tostring(lastMeshInfo))
--			lo('?? MI:'..tostring(m.obj:getPosition()))
--			lo('?? if_LM:'..tostring(lastMeshInfo))
--			lo('?? MI:'..tostring(m.obj:getPosition()))
--			U.dump(m, '?? for_OBJ:')
--		for k,v in pairs(m.obj) do
--			lo('?? for_Key:'..tostring(k))
--		end
			local geomain = M.forNode(xmain, {'COLLADA','library_geometries','geometry'})
--				lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
--				lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
			local geomain = M.forNode(xmain, {'COLLADA','library_geometries','geometry'})
--				lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
--				lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
--				lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
--				lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
			---- append lod as geometry
--				lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
--				lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
			---- append lod as geometry
--				lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
--				lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
			---- append lod as geometry
			local nd_maingeo = nodevs.kids[2]
				lo('??^^^^^^^^^^ if_KIDS:'..tableSize(nodevs.kids)..':'..tostring(nd_maingeo.attr['id'])) --..tostring(nd_maingeo.kids[2].name)) --..tostring(tableSize(nd_maingeo.kids[2])))
			nodevs = M.forNode(xmain, {'COLLADA','library_visual_scenes'})
			local nd_maingeo = nodevs.kids[2]
				lo('??^^^^^^^^^^ if_KIDS:'..tableSize(nodevs.kids)..':'..tostring(nd_maingeo.attr['id'])) --..tostring(nd_maingeo.kids[2].name)) --..tostring(tableSize(nd_maingeo.kids[2])))
			nodevs = M.forNode(xmain, {'COLLADA','library_visual_scenes'})
			local nd_maingeo = nodevs.kids[2]
				lo('??^^^^^^^^^^ if_KIDS:'..tableSize(nodevs.kids)..':'..tostring(nd_maingeo.attr['id'])) --..tostring(nd_maingeo.kids[2].name)) --..tostring(tableSize(nd_maingeo.kids[2])))
			nodevs = M.forNode(xmain, {'COLLADA','library_visual_scenes'})
		local tst = M.forNode(xmain, {'COLLADA','asset','created'})
			lo('??+++++++++++++++ if_TST:'..tostring(tst))
			for _,k in pairs(tst.kids) do
			for _,k in pairs(tst.kids) do
				lo('?? for_TST_KID:'.._..':'..tostring(k.type))
			end
		local cnd = M.forNode(xmain, {'COLLADA','library_images'})
			lo('?? if_IMG:'..tostring(cnd))
		cnd = M.toNode(cnd, 'image', {id='shot_png', name='shot_png'})
		local nd = M.forNode(xlod, {'COLLADA','library_geometries','geometry'})
			lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
		local ndmain = M.forNode(xmain, {'COLLADA','library_geometries'})
		local nd = M.forNode(xlod, {'COLLADA','library_geometries','geometry'})
			lo('?? if_GEO:'..tostring(nd)..':'..tostring(xlod.kids))
		local ndmain = M.forNode(xmain, {'COLLADA','library_geometries'})
		-- append lod as geometry
			lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
		ndmain.kids[#ndmain.kids+1] = nd
		-- append lod as geometry
			lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
		ndmain.kids[#ndmain.kids+1] = nd
		-- append lod as geometry
			lo('?? for_NDL:'..tostring(nd.type)..':'..tostring(nd.attr['id'])..':'..tostring(geomain.attr['id']))
		ndmain.kids[#ndmain.kids+1] = nd
		local nd_maingeo = nodevs.kids[2]
			lo('??^^^^^^^^^^ if_KIDS:'..tableSize(nodevs.kids)..':'..tostring(nd_maingeo.attr['id'])) --..tostring(nd_maingeo.kids[2].name)) --..tostring(tableSize(nd_maingeo.kids[2])))
--			U.dump(nd_maingeo)
		local nd_maingeo = nodevs.kids[2]
			lo('??^^^^^^^^^^ if_KIDS:'..tableSize(nodevs.kids)..':'..tostring(nd_maingeo.attr['id'])) --..tostring(nd_maingeo.kids[2].name)) --..tostring(tableSize(nd_maingeo.kids[2])))
--			U.dump(nd_maingeo)
		local nd_maingeo = nodevs.kids[2]
			lo('??^^^^^^^^^^ if_KIDS:'..tableSize(nodevs.kids)..':'..tostring(nd_maingeo.attr['id'])) --..tostring(nd_maingeo.kids[2].name)) --..tostring(tableSize(nd_maingeo.kids[2])))
--			U.dump(nd_maingeo)
--			for _,k in pairs(nodevs.kids) do
--				lo('?? for_KID:'.._..':'..tostring(k.name))
--			end
			)
				lo('?? if_IG:'..tostring(nd_ig)..':'..tostring(nd.id))
			kid.kids[#kid.kids+1] = nd_lod
			)
				lo('?? if_IG:'..tostring(nd_ig)..':'..tostring(nd.id))
			kid.kids[#kid.kids+1] = nd_lod
		local xml = M.xmlOn(editor.getLevelPath()..'bat/'..'exp_22762.dae')
			lo('?? for_node:'..tostring(xml))
--		for i,k in pairs(xml.kids) do
			end
--				U.dump(pos, '?? for_data:'..tostring(base[2]))
--[[
      U.dump(mbody)
--      lo('?? if_TUBE:'..tostring(af))
    if M.valid({mbody}) then
    if M.valid({mbody}) then
--        U.dump(mbody, '?? test_mdata:'..tostring(aedge))
      meshUp({mbody}, 'tst', groupEdit)
    {base},nil,true)
      lo('?? test_rc:'..tostring(inrc))
  end
    if M.valid({mbody}) then
--        U.dump(mbody, '?? test_mdata:'..tostring(aedge))
      meshUp({mbody}, 'tst', groupEdit)
		local i = U.inRC(vec3(-7.651718787,0.1104451204,6.400000774), {base})
			lo('?? if_inrc:'..tostring(i))
		out.apath = {base}
			local adata = T.forGable(base, nil, true)
				lo('?? GABLED:'..tostring(adata and #adata or nil))
--                U.dump(adata, '?? GABLED:')
					if true then return end
--                lo('?? 1st:'..tostring(av[1]))
				mat:registerObject('R_mat_'..t)
					lo('?? if_mat:'..tostring(scenetree.findObject('R_mat_'..t)))
			end
			end
		--        lo('?? ifmat:'..tostring(scenetree.findObject('R_512_green')))
			for k,f in pairs(matFiles) do
					lo('?? for_mat_FILE:'..tostring(f))
--                loadJsonMaterialsFile(v)
				local desc = jsonReadFile(f)
--                    lo('?? for_mat_json:'..tostring(desc))
--                    lo('?? for_mat_json:'..tostring(f)..':'..tostring(desc))
--                    lo('?? for_mat_json:'..tostring(desc))
--                    lo('?? for_mat_json:'..tostring(f)..':'..tostring(desc))
				if desc then
--                    lo('?? for_mat_json:'..tostring(desc))
--                    lo('?? for_mat_json:'..tostring(f)..':'..tostring(desc))
				if desc then
						local ind = U.index(amat, k)[1]
							lo('?? for_mat:'..k..':'..tostring(v.name)..':'..tostring(ind))
						if ind then
						local ind = U.index(amat, k)[1]
							lo('?? for_mat:'..k..':'..tostring(v.name)..':'..tostring(ind))
						if ind then
--        local t = os.execute("echo 'test'")
			lo('?? test:'..command..':'..tostring(os.clock()))
]]
	}, nil, nil, true)
		lo('?? OUT:'..tostring(out.fwhite and #out.fwhite or nil)..':'..tostring(out.fyell and #out.fyell or nil), true)
		if false then
	}, nil, nil, true)
		lo('?? OUT:'..tostring(out.fwhite and #out.fwhite or nil)..':'..tostring(out.fyell and #out.fyell or nil), true)
		if false then
M.onUp = function(arg)
        print('?? Tst.onUp:'..tostring(arg)..':'..tostring(E))
--        if true then return end
M.onUp = function(arg)
        print('?? Tst.onUp:'..tostring(arg)..':'..tostring(E))
--        if true then return end
@/lua/ge/extensions/gameplay/drift/freeroam/driftSpots.lua

    im.Text("Challenge started : " .. tostring(isInFreeroamChallenge))
    if activeLine then
      for _, data in ipairs(spot.saveData.scores) do
        im.Text(tostring(data.score))
      end
@/lua/ge/extensions/ui/messagesTasksAppContainers.lua
  if not container then
    log('E', logTag, 'container not found: ' .. tostring(containerId))
    return
  if not app then
    log('E', logTag, 'app not found: ' .. tostring(appId) .. ' for container: ' .. tostring(containerId))
    return
  if not app then
    log('E', logTag, 'app not found: ' .. tostring(appId) .. ' for container: ' .. tostring(containerId))
    return
  if not container then
    log('E', logTag, 'container not found: ' .. tostring(containerId))
    return false
  if not app then
    log('E', logTag, 'app not found: ' .. tostring(appId) .. ' for container: ' .. tostring(containerId))
    return false
  if not app then
    log('E', logTag, 'app not found: ' .. tostring(appId) .. ' for container: ' .. tostring(containerId))
    return false
  if not container then
    log('E', logTag, 'container not found: ' .. tostring(containerId))
    return
  if not container then
    log('E', logTag, 'container not found: ' .. tostring(containerId))
    return {}
  if not container then
    log('E', logTag, 'container not found: ' .. tostring(containerId))
    return {}
@/lua/ge/extensions/flowgraph/nodes/gfx/dof.lua
  else
    --print(" self.mode = " .. tostring(self.mode) .. " / self.timer = " .. tostring(self.timer) .. ' / fadeTime = ' .. tostring(fadeTime))
    local newVal = 0
  else
    --print(" self.mode = " .. tostring(self.mode) .. " / self.timer = " .. tostring(self.timer) .. ' / fadeTime = ' .. tostring(fadeTime))
    local newVal = 0
  else
    --print(" self.mode = " .. tostring(self.mode) .. " / self.timer = " .. tostring(self.timer) .. ' / fadeTime = ' .. tostring(fadeTime))
    local newVal = 0
@/lua/ge/extensions/flowgraph/baseModule.lua
  for k, v in pairs(derivedClass) do
    --print('k = ' .. tostring(k) .. ' = '.. tostring(v) )
    o[k] = v
  for k, v in pairs(derivedClass) do
    --print('k = ' .. tostring(k) .. ' = '.. tostring(v) )
    o[k] = v
@/lua/vehicle/jbeam/stage2.lua
  if type(beam.beamStrength) == 'string' then
    if tostring(beam.beamStrength) ~= tostring(tonumber(beam.beamStrength)) then
      log('E', "jbeam.pushToPhysics", "String value used on beamStrength property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamStrength) .. '\' = ' .. tonumber(beam.beamStrength))
  if type(beam.beamStrength) == 'string' then
    if tostring(beam.beamStrength) ~= tostring(tonumber(beam.beamStrength)) then
      log('E', "jbeam.pushToPhysics", "String value used on beamStrength property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamStrength) .. '\' = ' .. tonumber(beam.beamStrength))
    if tostring(beam.beamStrength) ~= tostring(tonumber(beam.beamStrength)) then
      log('E', "jbeam.pushToPhysics", "String value used on beamStrength property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamStrength) .. '\' = ' .. tonumber(beam.beamStrength))
    else
    else
      log('W', "jbeam.pushToPhysics", "String value used on beamStrength property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamStrength) .. '\' = ' .. tonumber(beam.beamStrength))
    end
  if type(beam.beamDamp) == 'string' then
    if tostring(beam.beamDamp) ~= tostring(tonumber(beam.beamDamp)) then
      log('E', "jbeam.pushToPhysics", "String value used on beamDamp property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamDamp) .. '\' = ' .. tonumber(beam.beamDamp))
  if type(beam.beamDamp) == 'string' then
    if tostring(beam.beamDamp) ~= tostring(tonumber(beam.beamDamp)) then
      log('E', "jbeam.pushToPhysics", "String value used on beamDamp property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamDamp) .. '\' = ' .. tonumber(beam.beamDamp))
    if tostring(beam.beamDamp) ~= tostring(tonumber(beam.beamDamp)) then
      log('E', "jbeam.pushToPhysics", "String value used on beamDamp property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamDamp) .. '\' = ' .. tonumber(beam.beamDamp))
    else
    else
      log('W', "jbeam.pushToPhysics", "String value used on beamDamp property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamDamp) .. '\' = ' .. tonumber(beam.beamDamp))
    end
  if type(beam.beamDeform) == 'string' then
    if tostring(beam.beamDeform) ~= tostring(tonumber(beam.beamDeform)) then
      log('E', "jbeam.pushToPhysics", "String value used on beamDeform property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamDeform) .. '\' = ' .. tonumber(beam.beamDeform))
  if type(beam.beamDeform) == 'string' then
    if tostring(beam.beamDeform) ~= tostring(tonumber(beam.beamDeform)) then
      log('E', "jbeam.pushToPhysics", "String value used on beamDeform property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamDeform) .. '\' = ' .. tonumber(beam.beamDeform))
    if tostring(beam.beamDeform) ~= tostring(tonumber(beam.beamDeform)) then
      log('E', "jbeam.pushToPhysics", "String value used on beamDeform property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamDeform) .. '\' = ' .. tonumber(beam.beamDeform))
    else
    else
      log('W', "jbeam.pushToPhysics", "String value used on beamDeform property of beam on nodes: " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ': \'' .. tostring(beam.beamDeform) .. '\' = ' .. tonumber(beam.beamDeform))
    end
  -- error detection
  if type(beam.id1) == "string" or type(beam.id2) == "string" and tostring(beam.optional) == "true" then
    log('W', "jbeam.pushToPhysics","- beam not committed as node was not found: " .. tostring(beam.id1) .. " -> " .. tostring(beam.id2) .. ' : ' .. dumps(beam))
  if type(beam.id1) == "string" or type(beam.id2) == "string" and tostring(beam.optional) == "true" then
    log('W', "jbeam.pushToPhysics","- beam not committed as node was not found: " .. tostring(beam.id1) .. " -> " .. tostring(beam.id2) .. ' : ' .. dumps(beam))
    beam.beamType = BEAM_BROKEN
  if type(beam.id1) == "string" or type(beam.id2) == "string" and tostring(beam.optional) == "true" then
    log('W', "jbeam.pushToPhysics","- beam not committed as node was not found: " .. tostring(beam.id1) .. " -> " .. tostring(beam.id2) .. ' : ' .. dumps(beam))
    beam.beamType = BEAM_BROKEN
  if node1pos.x == node2pos.x and node1pos.y == node2pos.y and node1pos.z == node2pos.z and
  beam.wheelID == nil and tostring(beam.optional) ~= "true" and beam.beamType ~= BEAM_BROKEN then
    local msg = "zero size beam between nodes " ..(vehicle.nodes[beam.id1].name or '-')..' and '..(vehicle.nodes[beam.id2].name or '-') .. ', beam details are:\n'
      if type(nodeMaterialTypeID) ~= "number" then
        --log('D', "jbeam.pushToPhysics","invalid node material id:"..tostring(nodeMaterialTypeID))
        nodeMaterialTypeID = vehicle.options.nodeMaterial or 0

  log('D', 'loader', 'Vehicle loading took: ' .. tostring(t:stop()) .. ' ms')
  return vdataStage1.vdata
@/lua/common/libs/xlsxlib/tests/JUnitXMLWriter.lua
    attr = {
      { type = "attribute", name = "tests", value = tostring(#testResults) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "tests", value = tostring(#testResults) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "time", value = tostring(totalDuration) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "time", value = tostring(totalDuration) },
    },
      { type = "attribute", name = "name", value = "LuaUnitTests" },
      { type = "attribute", name = "tests", value = tostring(#testResults) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "tests", value = tostring(#testResults) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "time", value = tostring(totalDuration) },
      { type = "attribute", name = "failures", value = tostring(testFailCount) },
      { type = "attribute", name = "time", value = tostring(totalDuration) },
    },
        { type = "attribute", name = "name", value = result.name },
        { type = "attribute", name = "time", value = tostring(result.duration) },
      },
@/lua/ge/extensions/editor/crawlEditor/missionPortTool.lua
  if not missionDir or not FS:directoryExists(missionDir) then
    log('E', logTag,"Mission directory does not exist: " .. tostring(missionDir))
    return false
        for i, mission in ipairs(missionsList) do
          im.PushID1(tostring(i))
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veNodeTriSelfCollisionDetector.lua
      debugDrawer:drawSphere(nodePos, resultData.nodeCollisionRadius, orangeColor)
      local nodeText = node.name and string.format("Node: %d (%s)", nodeId, node.name) or tostring(nodeId)
      debugDrawer:drawText(nodePos, nodeText, blackColor)
        local triNode1, triNode2, triNode3 = nodes[tri.id1], nodes[tri.id2], nodes[tri.id3]
        local triNode1Text = triNode1.name and string.format("%d (%s)", tri.id1, triNode1.name) or tostring(tri.id1)
        local triNode2Text = triNode2.name and string.format("%d (%s)", tri.id2, triNode2.name) or tostring(tri.id2)
        local triNode1Text = triNode1.name and string.format("%d (%s)", tri.id1, triNode1.name) or tostring(tri.id1)
        local triNode2Text = triNode2.name and string.format("%d (%s)", tri.id2, triNode2.name) or tostring(tri.id2)
        local triNode3Text = triNode3.name and string.format("%d (%s)", tri.id3, triNode3.name) or tostring(tri.id3)
        local triNode2Text = triNode2.name and string.format("%d (%s)", tri.id2, triNode2.name) or tostring(tri.id2)
        local triNode3Text = triNode3.name and string.format("%d (%s)", tri.id3, triNode3.name) or tostring(tri.id3)
        local triText = string.format("Triangle: %s - %s - %s", triNode1Text, triNode2Text, triNode3Text)

        local nodeText = node.name and string.format("%d (%s)", nodeId, node.name) or tostring(nodeId)
        local triNode1Text = triNode1.name and string.format("%d (%s)", tri.id1, triNode1.name) or tostring(tri.id1)
        local nodeText = node.name and string.format("%d (%s)", nodeId, node.name) or tostring(nodeId)
        local triNode1Text = triNode1.name and string.format("%d (%s)", tri.id1, triNode1.name) or tostring(tri.id1)
        local triNode2Text = triNode2.name and string.format("%d (%s)", tri.id2, triNode2.name) or tostring(tri.id2)
        local triNode1Text = triNode1.name and string.format("%d (%s)", tri.id1, triNode1.name) or tostring(tri.id1)
        local triNode2Text = triNode2.name and string.format("%d (%s)", tri.id2, triNode2.name) or tostring(tri.id2)
        local triNode3Text = triNode3.name and string.format("%d (%s)", tri.id3, triNode3.name) or tostring(tri.id3)
        local triNode2Text = triNode2.name and string.format("%d (%s)", tri.id2, triNode2.name) or tostring(tri.id2)
        local triNode3Text = triNode3.name and string.format("%d (%s)", tri.id3, triNode3.name) or tostring(tri.id3)
        local triText = string.format("%s - %s - %s", triNode1Text, triNode2Text, triNode3Text)
@/lua/ge/extensions/core/settings/graphic.lua
        if current == v then
          if shouldLog then log('D', 'graphic',"Sanitizing display mode - "..tostring(current)..": Passed.") end
          return
      end
      if shouldLog then log('D', 'graphic',"Sanitizing display mode - "..tostring(current)..": Failed. Patching to display mode 'Window'") end
      o.GraphicDisplayModes.set('Window')
      if displayMode == 'Window' then
        if shouldLog then log('D', 'graphic',"Sanitizing display resolution for Window mode - "..tostring(current)..": Passed.") end
        return
        if current == v then
          if shouldLog then log('D', 'graphic',"Sanitizing display resolution - "..tostring(current)..": Passed.") end
          return
      local desktopMode = GFXDevice.getDesktopMode() or {width = 1280, height = 720}
      local newMode = tostring(desktopMode.width)..' '..tostring(desktopMode.height)
      if shouldLog then log('D', 'graphic',"Sanitizing display resolution - "..tostring(current)..": Failed. Patching to "..newMode) end
      local desktopMode = GFXDevice.getDesktopMode() or {width = 1280, height = 720}
      local newMode = tostring(desktopMode.width)..' '..tostring(desktopMode.height)
      if shouldLog then log('D', 'graphic',"Sanitizing display resolution - "..tostring(current)..": Failed. Patching to "..newMode) end
      local newMode = tostring(desktopMode.width)..' '..tostring(desktopMode.height)
      if shouldLog then log('D', 'graphic',"Sanitizing display resolution - "..tostring(current)..": Failed. Patching to "..newMode) end
      o.GraphicDisplayResolutions.set(newMode)
        if current == v then
          if shouldLog then log('D', 'graphic', "Sanitizing refresh rate - "..tostring(current)..": Passed.") end
          return
      end
      if shouldLog then log('D', 'graphic',"Sanitizing refresh rate - "..tostring(current)..": Failed. Patching to "..tostring(modes.keys[1]).." hertz") end
      o.GraphicDisplayRefreshRates.set(modes.keys[1])
      end
      if shouldLog then log('D', 'graphic',"Sanitizing refresh rate - "..tostring(current)..": Failed. Patching to "..tostring(modes.keys[1]).." hertz") end
      o.GraphicDisplayRefreshRates.set(modes.keys[1])
        if current == v then
          if shouldLog then log('D', 'graphic',"Sanitizing display - "..tostring(current)..": Passed.") end
          return
      end
      if shouldLog then log('D', 'graphic',"Sanitizing display - "..tostring(current)..": Failed. Patching to display '"..tostring(modes.keys[1]).."'") end
      o.GraphicDisplayDriver.adapter = o.GraphicDisplayDriver.set(modes.keys[1])
      end
      if shouldLog then log('D', 'graphic',"Sanitizing display - "..tostring(current)..": Failed. Patching to display '"..tostring(modes.keys[1]).."'") end
      o.GraphicDisplayDriver.adapter = o.GraphicDisplayDriver.set(modes.keys[1])
      local value = settings.getValue('GraphicAntialiasType')
      -- log('I','','get GraphicAntialiasType = '..tostring(value))
      return value
    set = function (value)
      -- log('I','graphic',' setting GraphicOverallQuality = '..tostring(value))
      if type(value) == 'string' and tonumber(value) then

      o.GraphicOverallQuality.qualityLevel = tostring(value)
      local levelData = overallQualityPresets[value]
      for index, group in pairs(overallQualityPresets) do
        -- log('I','','  Checking group: '..tostring(index))
        local matchFound = true
          local presetValue = group[presetKey]
          -- log('I','','      Key: '..presetKey..':  preset = '..tostring(presetValue)..'  current = '..tostring(current))
          if tostring(presetValue) ~= tostring(current) then
          local presetValue = group[presetKey]
          -- log('I','','      Key: '..presetKey..':  preset = '..tostring(presetValue)..'  current = '..tostring(current))
          if tostring(presetValue) ~= tostring(current) then
          -- log('I','','      Key: '..presetKey..':  preset = '..tostring(presetValue)..'  current = '..tostring(current))
          if tostring(presetValue) ~= tostring(current) then
            matchFound = false
          -- log('I','','      Key: '..presetKey..':  preset = '..tostring(presetValue)..'  current = '..tostring(current))
          if tostring(presetValue) ~= tostring(current) then
            matchFound = false
        end
        -- log('I','','  ---------------- End of: '..index..' match found = '..tostring(matchFound)..'---------------------------')
      end
      end
      -- log('I','','Matched Group Index: '..tostring(matchedGroupIndex))
      if matchedGroupIndex == nil then
      local value = settings.getValue('PostFXSSAOGeneralQuality')
      -- log('I','','get PostFXSSAOGeneralQuality = '..tostring(value))
      return value
    set = function ( value )
      value = tostring(value)
      setConsoleVariable( '$pref::Shadows::disable', value)

  log('D','graphic','Applying graphic settings: '..tostring(displayDriver)..', '..graphicsOptions.GraphicDisplayModes.get()..', '..tostring(resolutionWidth)..' x '..tostring(resolutionHeight)..' '..tostring(refreshRate)..' Hz')

  log('D','graphic','Applying graphic settings: '..tostring(displayDriver)..', '..graphicsOptions.GraphicDisplayModes.get()..', '..tostring(resolutionWidth)..' x '..tostring(resolutionHeight)..' '..tostring(refreshRate)..' Hz')

  log('D','graphic','Applying graphic settings: '..tostring(displayDriver)..', '..graphicsOptions.GraphicDisplayModes.get()..', '..tostring(resolutionWidth)..' x '..tostring(resolutionHeight)..' '..tostring(refreshRate)..' Hz')

  log('D','graphic','Applying graphic settings: '..tostring(displayDriver)..', '..graphicsOptions.GraphicDisplayModes.get()..', '..tostring(resolutionWidth)..' x '..tostring(resolutionHeight)..' '..tostring(refreshRate)..' Hz')
  if newState.GraphicDisplayDriver and newState.GraphicDisplayDriver ~= M.selected_displayDriver then
    -- dump(tostring(M.selected_displayDriver) .. '  is now  '.. newState.GraphicDisplayDriver)
    if graphicsOptions.GraphicDisplayDriver and type(graphicsOptions.GraphicDisplayDriver.set) == 'function' then
  if newState.GraphicDisplayModes and newState.GraphicDisplayModes ~= M.selected_displayMode then
    -- dump(tostring(M.selected_displayMode) .. '  is now  '.. newState.GraphicDisplayModes)
    if graphicsOptions.GraphicDisplayModes and type(graphicsOptions.GraphicDisplayModes.set) == 'function' then
  if newState.GraphicDisplayResolutions and newState.GraphicDisplayResolutions ~= M.selected_resolution then
    -- dump(tostring(M.selected_resolution) .. '  is now  '.. newState.GraphicDisplayResolutions)
    if graphicsOptions.GraphicDisplayResolutions and type(graphicsOptions.GraphicDisplayResolutions.set) == 'function' then
  if newState.GraphicDisplayRefreshRates and newState.GraphicDisplayRefreshRates ~= M.selected_refreshRate then
    -- dump(tostring(M.selected_refreshRate) .. '  is now  '.. newState.GraphicDisplayRefreshRates)
    if graphicsOptions.GraphicDisplayRefreshRates and type(graphicsOptions.GraphicDisplayRefreshRates.set) == 'function' then
@/lua/ge/extensions/freeroam/facilities/fuelPrice.lua
  -- clone:postApply()
  clone:registerObject(tostring(objName).."_localCopy")
  groupLC:addObject(clone)
@/lua/ge/extensions/editor/raceEditor.lua
  if not json then
    log('E', logTag, 'unable to find race file: ' .. tostring(filename))
    return
@/lua/ge/extensions/editor/shapeEditor.lua
        im.NextColumn()
        im.TextUnformatted(tostring(shapePrev.mDetailSize))
        im.NextColumn()
        im.NextColumn()
        im.TextUnformatted(tostring(shapePrev.mDetailPolys))
        im.NextColumn()
        im.NextColumn()
        im.TextUnformatted(tostring(shapePrev.mPixelSize))
        im.NextColumn()
        im.NextColumn()
        im.TextUnformatted(tostring(shapePrev.mNumMaterials) )
        im.NextColumn()
        im.NextColumn()
        im.TextUnformatted(tostring(shapePrev.mNumDrawCalls))
        im.NextColumn()
        im.NextColumn()
        im.TextUnformatted(tostring(shapePrev.mNumBones))
        im.NextColumn()
        im.NextColumn()
        im.TextUnformatted(tostring(shapePrev.mNumWeights))
        im.NextColumn()
        im.NextColumn()
        im.TextUnformatted(tostring(shapePrev.mColMeshes))
        im.NextColumn()
        im.NextColumn()
        im.TextUnformatted(tostring(shapePrev.mColPolys))
        im.NextColumn()
              if type(v) ~= 'table' then
                im.TextUnformatted(tostring(v))
              else
              else
                if im.TreeNodeEx1(tostring(k), im.TreeNodeFlags_DefaultOpen) then
                  displayTree(v)
          for k,v in pairs(meshConstructor.createMeshLOD) do
            local src = tostring(v.src)
            if shapeInfo and shapeInfo.details[v.src+1] then
            im.NextColumn()
            im.TextUnformatted(tostring(v.amount))
            im.NextColumn()
            im.NextColumn()
            im.TextUnformatted(tostring(v.dest))
            im.NextColumn()
            if v.sloppy then
              im.TextUnformatted(tostring(v.sloppy))
              im.NextColumn()
              im.NextColumn()
              im.TextUnformatted(tostring(v.err))
              im.SameLine()
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/campaignTiles.lua
      label = translate("ui.common.property.difficulty"),
      value = tostring(campaign.difficulty)
    })
@/lua/common/jbeam/sections/meshs.lua
      if not (prop.idRef and prop.idX and prop.idY) then
        log('E', 'jbeam.pushToPhysics', 'prop IDs not set '.. tostring(prop.mesh))
        goto continue
      if not prop.translation then
        log('E', 'jbeam.pushToPhysics', 'prop translation not set: '.. tostring(prop.mesh))
        goto continue
      if not prop.rotation then
        log('E', 'jbeam.pushToPhysics', 'prop rotation not set: '.. tostring(prop.mesh))
        goto continue
      if pid < 0 then
        log('E', 'jbeam.pushToPhysics', 'unable to prop: '.. tostring(prop.mesh))
        goto continue
        if prop.mesh ~= p:getMeshName() then
          --print("GE renamed the prop mesh: " .. tostring(prop.mesh) .. ' > ' .. tostring(p:getMeshName()))
          prop.originalMesh = prop.mesh
        if prop.mesh ~= p:getMeshName() then
          --print("GE renamed the prop mesh: " .. tostring(prop.mesh) .. ' > ' .. tostring(p:getMeshName()))
          prop.originalMesh = prop.mesh
        if fid < 0 then
          log('E', "jbeam.pushToPhysics","unable to create flexmesh: " .. tostring(flexbody.mesh))
          goto continue
          if flexbody.mesh ~= f:getMeshName() then
            --print("GE renamed the flexbody mesh: " .. tostring(flexbody.mesh) .. ' > ' .. tostring(f:getMeshName()))
            flexbody.originalMesh = flexbody.mesh
          if flexbody.mesh ~= f:getMeshName() then
            --print("GE renamed the flexbody mesh: " .. tostring(flexbody.mesh) .. ' > ' .. tostring(f:getMeshName()))
            flexbody.originalMesh = flexbody.mesh

            --log('D', "jbeam.pushToPhysics","setInitialTransformation: " .. flexbody.mesh .. " = " .. tostring(pos) .. ", ".. tostring(rot) .. ", " .. tostring(scale))

            --log('D', "jbeam.pushToPhysics","setInitialTransformation: " .. flexbody.mesh .. " = " .. tostring(pos) .. ", ".. tostring(rot) .. ", " .. tostring(scale))

            --log('D', "jbeam.pushToPhysics","setInitialTransformation: " .. flexbody.mesh .. " = " .. tostring(pos) .. ", ".. tostring(rot) .. ", " .. tostring(scale))
@/lua/vehicle/protocols.lua
  for _,protocol in ipairs(protocols) do
    log("D", "", string.format("Shutdown of protocol %q for vehicle "..objectId.." ("..vehiclePath..") at %s:%d with an update rate of %d Hz (%s)", protocol.name, protocol.ip, protocol.port, protocol.updateRate, tostring(protocol)))
    if protocol.udpSocket then
      table.insert(protocols, protocol)
      log("D", "", string.format("Protocol %q active for vehicle "..objectId.." ("..vehiclePath..") at %s:%d with an update rate of %d Hz (%s)", protocol.name, protocol.ip, protocol.port, protocol.updateRate, tostring(protocol)))
    end
@/lua/ge/extensions/ui/vehicleSelector/vehicleSpecifications.lua
    else
      return tostring(value)
    end
    else
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
    if not type(value) == 'number' then
      return tostring(value)
    end
@/lua/ge/extensions/editor/forestView.lua
  --TODO: make sure to make a better nil check for internalName
  if imgui.Button("##_button_FID_" .. tostring(item.name), imgui.ImVec2(imgui.GetContentRegionAvailWidth(), fontSize)) then
    -- add to selection if ctrl is held
@/lua/ge/extensions/flowgraph/nodes/vehicle/fire/fire.lua
  builder:Middle()
  im.Text(tostring(self.selected))
end
@/lua/ge/extensions/flowgraph/nodes/scene/sevensegmentDisplay.lua
        -- name will be generated to avoid duplicate names
        local name = "ssDisplay_" .. tostring(os.time()) .. "_" .. self.id .. '_' .. i
        object:registerObject(name)
    -- name will be generated to avoid duplicate names
    local name = "ssDisplay_" .. tostring(os.time()) .. "_" .. self.id .. '_' .. 'dot_' .. name
    object:registerObject(name)
@/lua/ge/extensions/editor/dynamicDecals/textures.lua
            if loadImagesCount > 0 then
              im.PushID1("Texture_" .. tostring(k))
              if im.ImageButton(string.format("##textures_imageButton_%s", filePath), editor.getTempTextureObj(filePath).texId, im.ImVec2(thumbnailSize, thumbnailSize), im.ImVec2Zero, im.ImVec2One, (sel and tableContains(sel, filePath)) and selectedTextureCol.Value or nil) then
          if loadImagesCount > 0 then
            im.PushID1("Texture_" .. tostring(k))
            if im.ImageButton(string.format("##textures_imageButton_%s", filePath), editor.getTempTextureObj(filePath).texId, im.ImVec2(thumbnailSize, thumbnailSize), im.ImVec2Zero, im.ImVec2One, (sel and tableContains(sel, filePath)) and selectedTextureCol.Value or nil) then
        im.NextColumn()
        im.TextUnformatted(tostring(selectedTexturesSidecarContent[file].version))
        im.NextColumn()
@/lua/ge/extensions/core/flowgraphManager.lua
  local requireFilename = string.sub(filename, 1, string.len(filename) - 4)
  log("I","flowgraphManager","Reloading Node: " .. tostring(requireFilename))
  nodeLookup = nil
      if not status then
        log('E', '', 'error while loading node ' .. tostring(requireFilename) .. ' : ' .. tostring(node) .. '. ' .. debug.tracesimple())
      else
      if not status then
        log('E', '', 'error while loading node ' .. tostring(requireFilename) .. ' : ' .. tostring(node) .. '. ' .. debug.tracesimple())
      else
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamTableVis.lua
    if ok == false then
      log('E', "jbeam.parseFile","unable to decode JSON: "..tostring(filename))
      log('E', "jbeam.parseFile","JSON decoding error: "..tostring(data))
      log('E', "jbeam.parseFile","unable to decode JSON: "..tostring(filename))
      log('E', "jbeam.parseFile","JSON decoding error: "..tostring(data))
      return nil
  else
    log('E', "jbeam.parseFile","unable to read file: "..tostring(filename))
  end
@/lua/ge/extensions/editor/gen/decal.lua
    ]]
    --print('?? if_ADD:'..tostring(mathLib))
    local result = mathLib.mul(10, 20)
    local result = mathLib.mul(10, 20)
    print('??_____________ DLL_res:'..tostring(result))
end
--local mathLib = ffi.load("audll")
--print('?? if_LIB:'..tostring(result))

--    lo('= DECAL:'..tostring(veh)..':'..tostring(scenetree.findObject("Vegetation")))

--    lo('= DECAL:'..tostring(veh)..':'..tostring(scenetree.findObject("Vegetation")))
mm[{1,2}] = 5
lo('?? if_MM:'..tostring(mm[{1,2}]))
for key,v in pairs(mm) do
    local akey = {key}
    U.dump(key, '?? for_val:'..v..':'..tostring(mm[akey[1] ]))
end
D.inject = function(inreload)
        lo('>>******************* D.inject:'..tostring(inreload)) --..tostring(iM))
    groupDecal = scenetree.findObject('e_road')
D.inject = function(inreload)
        lo('>>******************* D.inject:'..tostring(inreload)) --..tostring(iM))
    groupDecal = scenetree.findObject('e_road')
    local obj = scenetree.findObjectById(id)
--        lo('?? if_ROAD:'..tostring(id)..':'..tostring(obj))
    local anode = editor.getNodes(obj)
    local obj = scenetree.findObjectById(id)
--        lo('?? if_ROAD:'..tostring(id)..':'..tostring(obj))
    local anode = editor.getNodes(obj)
D.clear = function()
        lo('>> D.clear:'..tostring(U._MODE)) --..(nstat or 0))
    askip = {}
            for _,o in pairs(aobj) do
--                lo('??^^^^^^^^^^^^^^^^^^^^^ for_gl_obj:'..tostring(o))
                editor.deleteRoad(tonumber(o))
    local adec = editor.getAllRoads()
--        lo('?? rem_from_ed:'..tostring(fedit)..':'..tostring(adec))
    for id,_ in pairs(adec) do
    local adec = editor.getAllRoads()
--        lo('?? rem_from_ed:'..tostring(fedit)..':'..tostring(adec))
    for id,_ in pairs(adec) do
        local obj = scenetree.findObjectById(id)
--            lo('?? for_DEC:'..id..':'..tostring(obj))
        if obj then
local across = {} -- from_[rdi,ndi] -> {to_[rdi,ndi]}, rdi - index in adec
--    lo('??_______________________________________ DECAL:'..tostring(D.junctionUp))
                        if aref[g[1]] ~= nil and aref[g[1]][g[2]] ~= nil then
--                            U.dump(aref[g[1]][g[2]], '?? for_reff:'..tostring(g[1])..':'..tostring(g[2]))
--                            if true then return end
                        if aref[g[1]] ~= nil and aref[g[1]][g[2]] ~= nil then
--                            U.dump(aref[g[1]][g[2]], '?? for_reff:'..tostring(g[1])..':'..tostring(g[2]))
--                            if true then return end
--                                            if rtgt == 362 and i == 526 and j == 355 and g[1] == 526 and g[2] == 355 then
--                                                lo('?? for_dist:'..n..'>'..k..':'..rsrc..'>'..rtgt..':'..tostring(adec[rsrc].list[n])..':'..tostring(adec[rtgt].list[k])..':'..(adec[rsrc].list[n] - adec[rtgt].list[k]):length())
--                                            end
--                                            if rtgt == 362 and i == 526 and j == 355 and g[1] == 526 and g[2] == 355 then
--                                                lo('?? for_dist:'..n..'>'..k..':'..rsrc..'>'..rtgt..':'..tostring(adec[rsrc].list[n])..':'..tostring(adec[rtgt].list[k])..':'..(adec[rsrc].list[n] - adec[rtgt].list[k]):length())
--                                            end
                                        end
--                                        lo('?? for_ND:'..rsrc..':'..rtgt..':'..n..':'..k..':'..tostring(adec[rsrc][n])..':'..tostring(adec[rtgt][k]))
--                                        return
                                        end
--                                        lo('?? for_ND:'..rsrc..':'..rtgt..':'..n..':'..k..':'..tostring(adec[rsrc][n])..':'..tostring(adec[rtgt][k]))
--                                        return
    out.across = across
        lo('<< forCross:'..tableSize(across)..':'..nc) --..':'..tostring(out.avedit[1])..':'..tostring(out.avedit[2]))
--        U.dump(across)
    out.across = across
        lo('<< forCross:'..tableSize(across)..':'..nc) --..':'..tostring(out.avedit[1])..':'..tostring(out.avedit[2]))
--        U.dump(across)
    tb = extensions.editor_terrainEditor.getTerrainBlock()
--        print('?? decalsLoad:'..tostring(tb))
    if tb then
        local rdlist = editor.getAllRoads()
            lo('>> decalsLoad:'..tostring(L)) --..' m/p=:'..tostring(g)..' N='..tableSize(rdlist)..':'..tostring(obj))
            local icheck
        local rdlist = editor.getAllRoads()
            lo('>> decalsLoad:'..tostring(L)) --..' m/p=:'..tostring(g)..' N='..tableSize(rdlist)..':'..tostring(obj))
            local icheck
        local rdlist = editor.getAllRoads()
            lo('>> decalsLoad:'..tostring(L)) --..' m/p=:'..tostring(g)..' N='..tableSize(rdlist)..':'..tostring(obj))
            local icheck
            local rd = scenetree.findObjectById(roadID)
    --                lo('?? PI:'..tostring(`rd and rd:getOrCreatePersistentID())) -- getField('material')) or) --rd.persistentId))
    --            local mt = rd.material -- rd:getField('material')
--            if list then
--                lo('?? for_LR:'..ir..':'..#r.list..':'..tostring(r.isline))
--            end
--            if r.id == dbg then
--                lo('??^^^^^^^^^^^^^^^^^ dL_CHECK:'..r.id..':'..r.ind..':'..tostring(r.skip)..':'..#r.list..':'..ir)
--            end
--                if #aref[i][j] > 0 then
--                    lo('?? for_ref:'..i..':'..j..':'..#aref[i][j]..' n:'..tostring(n)..':'..ir)
--                end
--        local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
--        U.dump(aref[526][355], '???*************** aref:'..tostring(aref[526])..':'..tostring(n)..':'..i..':'..j)
--        lo('?? pos:'..tostring(adec[302].list[1])..':'..tostring(adec[49].list[1])..':'..tostring(adec[362].list[3])..':'..tostring(adec[49].list[1]))
--        local i,j = math.floor((n.y + L)/grid) + 1,math.floor((n.x + L)/grid) + 1
--        U.dump(aref[526][355], '???*************** aref:'..tostring(aref[526])..':'..tostring(n)..':'..i..':'..j)
--        lo('?? pos:'..tostring(adec[302].list[1])..':'..tostring(adec[49].list[1])..':'..tostring(adec[362].list[3])..':'..tostring(adec[49].list[1]))
--        U.dump(aref[526][355], '???*************** aref:'..tostring(aref[526])..':'..tostring(n)..':'..i..':'..j)
--        lo('?? pos:'..tostring(adec[302].list[1])..':'..tostring(adec[49].list[1])..':'..tostring(adec[362].list[3])..':'..tostring(adec[49].list[1]))
    forCross() --dbg)
--        U.dump(aref[526][355], '???*************** aref:'..tostring(aref[526])..':'..tostring(n)..':'..i..':'..j)
--        lo('?? pos:'..tostring(adec[302].list[1])..':'..tostring(adec[49].list[1])..':'..tostring(adec[362].list[3])..':'..tostring(adec[49].list[1]))
    forCross() --dbg)
--        U.dump(aref[526][355], '???*************** aref:'..tostring(aref[526])..':'..tostring(n)..':'..i..':'..j)
--        lo('?? pos:'..tostring(adec[302].list[1])..':'..tostring(adec[49].list[1])..':'..tostring(adec[362].list[3])..':'..tostring(adec[49].list[1]))
    forCross() --dbg)
--        U.dump(aref[526][355], '???*************** aref:'..tostring(aref[526])..':'..tostring(n)..':'..i..':'..j)
--        lo('?? pos:'..tostring(adec[302].list[1])..':'..tostring(adec[49].list[1])..':'..tostring(adec[362].list[3])..':'..tostring(adec[49].list[1]))
    forCross() --dbg)
                abr[#abr+1] = adec[b[1]]
--                    lo('?? to_CSTAR:'..ind..':'..i..':'..b[1]..':'..tostring(adec[b[1]].ind)..':'..tostring(adec[b[1]].isline))
            end
                abr[#abr+1] = adec[b[1]]
--                    lo('?? to_CSTAR:'..ind..':'..i..':'..b[1]..':'..tostring(adec[b[1]].ind)..':'..tostring(adec[b[1]].isline))
            end
                                b.list[#b.list-1] - b.list[#b.list]):normalized()
                                lo('?? for_BB:'..b.ind..':'..tostring(b.list[1])..':'..U.proj2D(b.list[1]):distance(U.proj2D(p))..':'..tostring(dirb)..':'..tostring(p)..':'..U.vang(dirb,vec3(1,0),true))
                            if t == 1 then
                                b.list[#b.list-1] - b.list[#b.list]):normalized()
                                lo('?? for_BB:'..b.ind..':'..tostring(b.list[1])..':'..U.proj2D(b.list[1]):distance(U.proj2D(p))..':'..tostring(dirb)..':'..tostring(p)..':'..U.vang(dirb,vec3(1,0),true))
                            if t == 1 then
                                b.list[#b.list-1] - b.list[#b.list]):normalized()
                                lo('?? for_BB:'..b.ind..':'..tostring(b.list[1])..':'..U.proj2D(b.list[1]):distance(U.proj2D(p))..':'..tostring(dirb)..':'..tostring(p)..':'..U.vang(dirb,vec3(1,0),true))
                            if t == 1 then
--                            if b.ind == 19 then
--                                lo('??^^^^^^^^^^^^ for_BR_19:'..#ajunc..':'..b.ind..':'..ajunc[#ajunc].p:distance(b.list[1])..':'..tostring(b.jfr)..':'..tostring(b.jto))
--                            end
--                            if b.ind == 19 then
--                                lo('??^^^^^^^^^^^^ for_BR_19:'..#ajunc..':'..b.ind..':'..ajunc[#ajunc].p:distance(b.list[1])..':'..tostring(b.jfr)..':'..tostring(b.jto))
--                            end
        end
--        lo('?? forc:'..tostring(ind)..':'..tostring(c[1]))
--        U.dump(c, '?? forc1:'..ind)
        end
--        lo('?? forc:'..tostring(ind)..':'..tostring(c[1]))
--        U.dump(c, '?? forc1:'..ind)
    end
        lo('?? ajunc:'..#ajunc) --..':'..tostring(ajunc[1].p))
--        U.dump(ajunc, '?? for_ajunc:')
--        U.dump(adec[10].list, '?? list:')
        lo('<< decalsLoad:'..(nrd-1)..':'..#across..' adec:'..#adec..'/'..tableSize(editor.getAllRoads())..' aref:'..#aref..':'..tableSize(aref)) --..':'..tostring(adec[49].list[1]))
--        U.camSet({-497.75, 315.61, 227.73, -0.10119, 0.277522, -0.897572, -0.327271})
--[[
                    lo('?? to_list:'..(#adec+1)..':'..tostring(list and list[#adec+1].isline or nil))
    --             = list and list[nrd] or {id = roadID, list = anode, aw = aw, ind=#adec+1}
        local v = f and f(p) or p
--            lo('?? for_v:'..tostring(v))
--            if cname == 'red' then
--            if cname == 'red' then
--                lo('??*************** toMark:'..tostring(v)..':'..tostring(keepz)..':'..tostring(forZ(v)))
--            end
--            if cname == 'red' then
--                lo('??*************** toMark:'..tostring(v)..':'..tostring(keepz)..':'..tostring(forZ(v)))
--            end
--            if cname == 'red' then
--                lo('??*************** toMark:'..tostring(v)..':'..tostring(keepz)..':'..tostring(forZ(v)))
--            end
    grid = tb:getSquareSize()
        lo('?? if_TB: size:'..tostring(tersize)..':'..forZ(vec3(-tersize.x/2+25,0.2))..' wb:'..tostring(tb:getWorldBox())..':'..tostring(tfr))
--            U.dump(extents, '?? for_TB:'..tostring(tb)..' sz:'..tostring(tb:getSquareSize()))
    grid = tb:getSquareSize()
        lo('?? if_TB: size:'..tostring(tersize)..':'..forZ(vec3(-tersize.x/2+25,0.2))..' wb:'..tostring(tb:getWorldBox())..':'..tostring(tfr))
--            U.dump(extents, '?? for_TB:'..tostring(tb)..' sz:'..tostring(tb:getSquareSize()))
    grid = tb:getSquareSize()
        lo('?? if_TB: size:'..tostring(tersize)..':'..forZ(vec3(-tersize.x/2+25,0.2))..' wb:'..tostring(tb:getWorldBox())..':'..tostring(tfr))
--            U.dump(extents, '?? for_TB:'..tostring(tb)..' sz:'..tostring(tb:getSquareSize()))
        lo('?? if_TB: size:'..tostring(tersize)..':'..forZ(vec3(-tersize.x/2+25,0.2))..' wb:'..tostring(tb:getWorldBox())..':'..tostring(tfr))
--            U.dump(extents, '?? for_TB:'..tostring(tb)..' sz:'..tostring(tb:getSquareSize()))
else
        lo('?? if_TB: size:'..tostring(tersize)..':'..forZ(vec3(-tersize.x/2+25,0.2))..' wb:'..tostring(tb:getWorldBox())..':'..tostring(tfr))
--            U.dump(extents, '?? for_TB:'..tostring(tb)..' sz:'..tostring(tb:getSquareSize()))
else
--        if true then return end
        lo('?? D.undo:'..tableSize(adec)..'/'..#adec..':'..tableSize(mask)..':'..tostring(silent))
    for ij,d in pairs(mask) do
    for ij,d in pairs(mask) do
--            U.dump(ij, '?? undo_ij:'..tostring(grid2p(ij))..':'..tostring(d[1]))
        tb:setHeightWs(grid2p(d[4]), d[1]) -- 107) -- d[1])
    for ij,d in pairs(mask) do
--            U.dump(ij, '?? undo_ij:'..tostring(grid2p(ij))..':'..tostring(d[1]))
        tb:setHeightWs(grid2p(d[4]), d[1]) -- 107) -- d[1])
        if ilist == 0 then return end
        lo('>> road2ter:'..tostring(ilist and #ilist or nil)..':'..tostring(out.inall)..':'..#apick..':'..tostring(cdesc))
    if not ilist then
        if ilist == 0 then return end
        lo('>> road2ter:'..tostring(ilist and #ilist or nil)..':'..tostring(out.inall)..':'..#apick..':'..tostring(cdesc))
    if not ilist then
        if ilist == 0 then return end
        lo('>> road2ter:'..tostring(ilist and #ilist or nil)..':'..tostring(out.inall)..':'..#apick..':'..tostring(cdesc))
    if not ilist then
    if not ilist then
        if dbg then lo('?? road2ter_ifind:'..tostring(cpick)..':'..tostring(croad)..':'..tostring(cdesc)..':'..#apick) end
        if cdesc then
    if not ilist then
        if dbg then lo('?? road2ter_ifind:'..tostring(cpick)..':'..tostring(croad)..':'..tostring(cdesc)..':'..#apick) end
        if cdesc then
    if not ilist then
        if dbg then lo('?? road2ter_ifind:'..tostring(cpick)..':'..tostring(croad)..':'..tostring(cdesc)..':'..#apick) end
        if cdesc then
--            dbg = true
--                lo('?? road2ter_one:'..list[1].ind..':'..tostring(dbg))
        end
        local bcross = across[ind]
            lo('?? conf_road:'.._..':'..ind..':'..tostring(adec[ind].list[1])..':'..tableSize(bcross))
        if bcross then
                out.avedit = {}
                if dbg then U.dump(bcross, '?? road2ter:'..ind..':'..adec[ind].id..':'..tableSize(bcross)..' w:'..tostring(rd.aw and rd.aw[1] or rd.w)) end
            --- go over cross points on the branch
                    for j,b in pairs(ref) do
            --                U.dump(b, '?? for_B:'..tostring(j))
            --                lo('?? for_B2:'..tostring(isnan(b))..':'..tostring(j)..':'..tostring(b))
            --                U.dump(b, '?? for_B:'..tostring(j))
            --                lo('?? for_B2:'..tostring(isnan(b))..':'..tostring(j)..':'..tostring(b))
            --                U.dump(ep, '?? for_ep:')
            --                U.dump(b, '?? for_B:'..tostring(j))
            --                lo('?? for_B2:'..tostring(isnan(b))..':'..tostring(j)..':'..tostring(b))
            --                U.dump(ep, '?? for_ep:')
            --                U.dump(b, '?? for_B:'..tostring(j))
            --                lo('?? for_B2:'..tostring(isnan(b))..':'..tostring(j)..':'..tostring(b))
            --                U.dump(ep, '?? for_ep:')
                    end
                        if true or dbg then lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pre_flat:'..i..':'..tostring(jrad)..':'..tostring(c)) end
                    local aset = terFlat(c, jrad, nil) --, dbg ~= nil)
                    end
                        if true or dbg then lo('??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pre_flat:'..i..':'..tostring(jrad)..':'..tostring(c)) end
                    local aset = terFlat(c, jrad, nil) --, dbg ~= nil)
                        if dbg then
                            lo('?? to_flat:'..i..':'..tostring(jrad)..':'..tableSize(mask))
                        end
    --                    out.acyan = {c}
                        lo('?? for_c:'..i..':'..tostring(c))
                    end
                        aang[#aang+1] = {ind=b.ird, ang=U.vang(dir0, dir, true), dir=b.inode==1 and 1 or -1}
        --                        lo('?? for_c_b:'..i..':'..j..':'..tostring(dir))
        --                    out.avedit[#out.avedit+1] = c+dir*5
                                pc = D.borderCross(rd.body, adec[aang[k-1].ind].body, d.dir==1 and 'right' or 'left', aang[k-1].dir==1 and 'left' or 'right', d.dir==1 and 0 or 1, aang[k-1].dir==1 and 0 or 1)
                                    if dbg then lo('??++++++++++++ cross_right:'..k..':'..tostring(pc)..':'..d.dir..':'..tostring(aang[k-1].dir)..':'..tostring(aang[k-1].ind)) end
        --                            out.acyan = {pc+vec3(0,0,forZ(pc))}
                                pc = D.borderCross(rd.body, adec[aang[k-1].ind].body, d.dir==1 and 'right' or 'left', aang[k-1].dir==1 and 'left' or 'right', d.dir==1 and 0 or 1, aang[k-1].dir==1 and 0 or 1)
                                    if dbg then lo('??++++++++++++ cross_right:'..k..':'..tostring(pc)..':'..d.dir..':'..tostring(aang[k-1].dir)..':'..tostring(aang[k-1].ind)) end
        --                            out.acyan = {pc+vec3(0,0,forZ(pc))}
                                pc = D.borderCross(rd.body, adec[aang[k-1].ind].body, d.dir==1 and 'right' or 'left', aang[k-1].dir==1 and 'left' or 'right', d.dir==1 and 0 or 1, aang[k-1].dir==1 and 0 or 1)
                                    if dbg then lo('??++++++++++++ cross_right:'..k..':'..tostring(pc)..':'..d.dir..':'..tostring(aang[k-1].dir)..':'..tostring(aang[k-1].ind)) end
        --                            out.acyan = {pc+vec3(0,0,forZ(pc))}
        --                            out.avedit = {pc, D.epos(rd.body, d.dir==-1 and rd.body:getEdgeCount()-1 or 0, d.dir==-1 and 'right' or 'left')}
                                    if dbg then lo('??+++++++++++++++++++ cross_left:'..tostring(c)..':'..r..':'..d.dir) end
        --                            out.acyan = {c, D.epos(rd.body, d.dir==-1 and rd.body:getEdgeCount()-1 or 0, d.dir==-1 and 'right' or 'left')}
            end
--                lo('??___________ if_PREC:'..#list..':'..tostring(rd.body)..)
            if precomp and #list == 1 then
                dn,p = D.toSide(cs, rd)
                        lo('?? cs2:'..tostring(cs)..':'..rd.frtoside[2]..' L:'..rd.L..'/'..cs:distance(rd.list[#rd.list])..':'..(rd.L-(cs:distance(rd.list[#rd.list])+3)))
                rd.apin[#rd.apin+1] = {d=rd.L-(cs:distance(rd.list[#rd.list])+3), h=forZ(cs)}
--                            lo('??^^^^^^^^ pH:'..j..':'..i..':'..rd.apin[2].h..'>'..rd.apin[#rd.apin-1].h..':'..dist..':'..rd.apin[#rd.apin-1].d..':'..rd.apin[2].d)
--                        lo('?? to_height: i:'..i..' dd:'..dd..' d:'..d..'/ dist:'..dist..' c:'..c..':'..tostring(p)..':'..pin.h)
--                    cie = i
                    break
    --                    lo('?? set_HP:'..cpin..' ie:'..i..':'..d..'/'..dist..' dd:'..dd..' c:'..c..':'..tostring(forZ(p)))
                end
                    local a,b
                        if dbg then lo('?? for_i:'..i..':'..tostring(rd.apin[i-dir].fix)) end
                    if i < #rd.apin-1 and not rd.apin[i-dir].fix then
        local acp = {{0}}
--            lo('?? sstart:'..tostring(acp[]))
        for i=1,nsstep do
            local pm = D.onSide(rd, 'middle', i*sstep)
--                lo('?? for_c_dist:'..i..':'..(i*sstep)..'/'..rd.L..tostring((i*sstep)-rd.L==0)..':'..((i*sstep)-rd.L)..':'..tostring(pm))
            if math.abs(i*sstep - rd.L) < U.small_val then
            local pm = D.onSide(rd, 'middle', i*sstep)
--                lo('?? for_c_dist:'..i..':'..(i*sstep)..'/'..rd.L..tostring((i*sstep)-rd.L==0)..':'..((i*sstep)-rd.L)..':'..tostring(pm))
            if math.abs(i*sstep - rd.L) < U.small_val then
            if dbg then
                lo('?? edges:'..#ae..':'..tostring(ae[#ae])..':'..tostring(rd.list[#rd.list]))
--                toMark(ae, 'mag', nil, 0.05, 0.2)
            if dbg then
                lo('?? edges:'..#ae..':'..tostring(ae[#ae])..':'..tostring(rd.list[#rd.list]))
--                toMark(ae, 'mag', nil, 0.05, 0.2)
                local pci = grid2p({ic,jc})
        --            lo('?? for_CENTER:'..ic..':'..jc..':'..tostring(pc))
        --            lo('?? ij_c:'..tostring(jc)..':'..tostring(ic)..':'..ri..':'..r)
        --            lo('?? for_CENTER:'..ic..':'..jc..':'..tostring(pc))
        --            lo('?? ij_c:'..tostring(jc)..':'..tostring(ic)..':'..ri..':'..r)
-- get relevant edges
        --            lo('?? for_CENTER:'..ic..':'..jc..':'..tostring(pc))
        --            lo('?? ij_c:'..tostring(jc)..':'..tostring(ic)..':'..ri..':'..r)
-- get relevant edges

        --                U.dump(legend['blue'], '?? for_blue:'..tostring(legend['blue'][1].alpha))
        --[[
]]
--                                    lo('?? mark:'..tostring(amark[#amark])..':'..math.floor(d/step)..':'..tostring(math.floor(d/step)==15))
                        if true then
]]
--                                    lo('?? mark:'..tostring(amark[#amark])..':'..math.floor(d/step)..':'..tostring(math.floor(d/step)==15))
                        if true then
--                                if p:distance(cp) < 3.5 then
--                                    lo('?? for_crv:'..d..':'..math.floor(d/sstep+0.5)..':'..tostring(crv))
--                                end
--                                                    bank = 3
--                                                    lo('??********** BB2:'..ds..':'..tostring(s))
--                                                end
--                                                        if dbg and math.floor(d/step+0.5)==dbg_step then
--                                                            lo('?? on_SIDE:'..tostring(ps)..':'..tostring(p))
--                                                        end
--                                                        if dbg and math.floor(d/step+0.5)==dbg_step then
--                                                            lo('?? on_SIDE:'..tostring(ps)..':'..tostring(p))
--                                                        end
                                                        if p:distance(vec3(398,1083)) < 2 then
                                                            lo('?? for_curve:'..tostring(crv))
                                                            out.aseg[#out.aseg+1] = {p+vec3(0,0,forZ(p)+1), pp+vec3(0,0,forZ(pp)+1)}
                                                        if p:distance(vec3(382,1071)) < 2 then
                                                            lo('?? for_curve2:'..tostring(crv))
                                                            out.aseg[#out.aseg+1] = {p+vec3(0,0,forZ(p)+1), pp+vec3(0,0,forZ(pp)+1)}
--                                                        am2[#am2+1] = p
--                                                            lo('??______ for_DH: dh'..dh..' crv:'..tostring(crv)..':'..rdir..':'..tostring(p))
                                                    end
--                                                        am2[#am2+1] = p
--                                                            lo('??______ for_DH: dh'..dh..' crv:'..tostring(crv)..':'..rdir..':'..tostring(p))
                                                    end
                                                    if p:distance(cp) < 1.1 then
                                                            lo('?? for_DH_near2:'..i..':'..j..' dh:'..dh..' crv:'..tostring(crv)..':'..ds..':'..ie)
                                                    end
--                                                        am2[#am2+1] = p
                                                        lo('??______ for_DH: dh:'..dh..' crv:'..tostring(crv)..':'..ds..':'..ie) --..tostring(p))
                                                end
--                                                        am2[#am2+1] = p
                                                        lo('??______ for_DH: dh:'..dh..' crv:'..tostring(crv)..':'..ds..':'..ie) --..tostring(p))
                                                end
                                                if p:distance(cp) < 1.1 then
                                                        lo('?? for_DH_near:'..i..':'..j..' dh:'..dh..' crv:'..tostring(crv)..':'..ds..':'..ie)
                                                end
                                                end
--                                                lo('?? for_DS:'..k..':'..tostring(ds)..'/'..rd.apin[k].d..':'..tostring(p))
                                            end
                                                end
--                                                lo('?? for_DS:'..k..':'..tostring(ds)..'/'..rd.apin[k].d..':'..tostring(p))
                                            end
                                if dbg and math.floor(d/step+0.5) == dbg_step then
                                        lo('?? no_proj:'..tostring(p)..':'..(i-ic)..':'..(j-jc))
--                                    am2[#am2+1] = p
--                                    am2[#am2+1] = p
--                                    lo('?? for_curv:'..tostring(crv))
                                end
                                if i == 3091 and j == 2614 then
--                                        U.dump(ae,'?? for_IJ:'..i..':'..j..':'..#ae..':'..#am3..':'..tostring(D.epos(rd.body,1)))
--                                        toMark(am3, 'mag', nil, 0.05, 0.3)
                                    out.white = {p + vec3(0,0,forZ(p)), pp + vec3(0,0,forZ(pp))}
                                        U.dump(out.ared, '?? pp:'..tostring(p)..':'..tostring(pp))
                                end
                                    out.white = {p + vec3(0,0,forZ(p)), pp + vec3(0,0,forZ(pp))}
                                        U.dump(out.ared, '?? pp:'..tostring(p)..':'..tostring(pp))
                                end
        --            for key,d in pairs(mask) do
        --                U.dump(d, '?? for_mask:'..tostring(key))
        --            end
        local rd = list[1]
--            lo('?? for_ASET:'..rd.ind..':'..tostring(rd.aset and #rd.aset or nil))
        if not dhist[rd.ind] then
        dhist[rd.ind][#dhist[rd.ind]+1] = deepcopy(mask)
            lo('?? to_hist:'..rd.ind..':'..tableSize(dhist[rd.ind][#dhist[rd.ind]])..':'..tostring(rd.aset and tableSize(rd.aset) or nil)..' lines:'..tostring(rd.aline and #rd.aline or nil))
        -- update ajacent
        dhist[rd.ind][#dhist[rd.ind]+1] = deepcopy(mask)
            lo('?? to_hist:'..rd.ind..':'..tableSize(dhist[rd.ind][#dhist[rd.ind]])..':'..tostring(rd.aset and tableSize(rd.aset) or nil)..' lines:'..tostring(rd.aline and #rd.aline or nil))
        -- update ajacent
            d = d + dd
                lo('?? for_ipin:'..i..':'..cpin..':'..tostring(pos)..' dd:'..dd..' d:'..d..'/ dist:'..dist)
            if d > dist then
                p = c*ppos + (1-c)*pos
                    lo('?? set_HP:'..cpin..' ie:'..i..':'..d..'/'..dist..' dd:'..dd..' c:'..c..':'..tostring(forZ(p)))
                if not rd.apin[cpin].fix then
                    rd.apin[cpin].h = forZ(p)
--                        lo('?? for_H:'..cpin..':'..tostring(rd.apin[cpin].h))
                end
            if #adec < 5 then
                lo('?? lanes:'..tostring(rd.lanesRight)..':'..rd.lanesLeft)
            end
    local ac = U.split(c,',')
--            lo('?? for_c:'..tostring(c)..':'..ac[1]..':'..ac[2])
--            break
--                if #aref[i][j] > 0 then
--                    lo('?? for_ref:'..i..':'..j..':'..#aref[i][j]..' n:'..tostring(n)..':'..ir)
--                end
end
--        lo('<< decalsLoad:'..tostring(#aref)..':'..tostring(#aref[100])..':'..nn)
--        U.dump(aref[365][455][1], '?? forr:')
end
--        lo('<< decalsLoad:'..tostring(#aref)..':'..tostring(#aref[100])..':'..nn)
--        U.dump(aref[365][455][1], '?? forr:')
    local eprev = epos(rd.body, 0, side)
--        lo('?? rdL:'..tostring(eprev))
    for i=1,nsec-1 do
        local ce = epos(rd.body, i, side)
--            lo('?? rdL2:'..tostring(ce))
        d = d + eprev:distance(ce)
    end
        if dbg then lo('?? toPath_imi:'..tostring(imi)..':'..side) end
                local c = e1p*(1-s) + e2p*s
    --                    lo('?? if_e2d:'..tostring(rd.e2d)..':'..e1..':'..e2)
                return c, c:distance(p), rd.e2d[e1]*(1-s) + rd.e2d[e2]*s, e1
            local c = e1p*(1-s) + e2p*s
--                    lo('?? if_e2d:'..tostring(rd.e2d)..':'..e1..':'..e2)
            return c, c:distance(p), rd.e2d[e1]*(1-s) + rd.e2d[e2]*s, e1
local function onSide(rd, side, dist, margin, dbg)
        if dbg then lo('?? onSide0:'..dist..'/'..rd.L..':'..tostring(dbg)..':'..tostring(side)..':'..roadLength(rd)) end
    if not margin then margin = 0 end
local function onSide(rd, side, dist, margin, dbg)
        if dbg then lo('?? onSide0:'..dist..'/'..rd.L..':'..tostring(dbg)..':'..tostring(side)..':'..roadLength(rd)) end
    if not margin then margin = 0 end
    local nsec = obj:getEdgeCount()
--        lo('>> onSide:'..nsec..':'..tostring(rd:getMiddleEdgePosition(0)))
--[[
            d = d + dd
    --            if dbg then lo('?? onSide:'..i..'/'..nsec..':'..d..'/'..dist..':'..tostring(epos(rd, nsec))..':'..tostring(epos(rd, i+1))) end
                    if dbg then lo('?? for_d:'..i..':'..d..'/'..dist..':'..tostring(d==dist)) end
            d = d + dd
    --            if dbg then lo('?? onSide:'..i..'/'..nsec..':'..d..'/'..dist..':'..tostring(epos(rd, nsec))..':'..tostring(epos(rd, i+1))) end
                    if dbg then lo('?? for_d:'..i..':'..d..'/'..dist..':'..tostring(d==dist)) end
    --            if dbg then lo('?? onSide:'..i..'/'..nsec..':'..d..'/'..dist..':'..tostring(epos(rd, nsec))..':'..tostring(epos(rd, i+1))) end
                    if dbg then lo('?? for_d:'..i..':'..d..'/'..dist..':'..tostring(d==dist)) end
            if d - dist > -U.small_val then
--            )
--                lo('?? BC:'..i..':'..j..':'..tostring(U.proj2D(sas[1]))..':'..tostring(U.proj2D(sas[2]))..':'..tostring(U.proj2D(sbs[1]))..':'..tostring(U.proj2D(sbs[2])))
            local c,s = U.segCross(U.proj2D(sas[1]),U.proj2D(sas[2]),U.proj2D(sbs[1]),U.proj2D(sbs[2]))
--            )
--                lo('?? BC:'..i..':'..j..':'..tostring(U.proj2D(sas[1]))..':'..tostring(U.proj2D(sas[2]))..':'..tostring(U.proj2D(sbs[1]))..':'..tostring(U.proj2D(sbs[2])))
            local c,s = U.segCross(U.proj2D(sas[1]),U.proj2D(sas[2]),U.proj2D(sbs[1]),U.proj2D(sbs[2]))
--            )
--                lo('?? BC:'..i..':'..j..':'..tostring(U.proj2D(sas[1]))..':'..tostring(U.proj2D(sas[2]))..':'..tostring(U.proj2D(sbs[1]))..':'..tostring(U.proj2D(sbs[2])))
            local c,s = U.segCross(U.proj2D(sas[1]),U.proj2D(sas[2]),U.proj2D(sbs[1]),U.proj2D(sbs[2]))
--            )
--                lo('?? BC:'..i..':'..j..':'..tostring(U.proj2D(sas[1]))..':'..tostring(U.proj2D(sas[2]))..':'..tostring(U.proj2D(sbs[1]))..':'..tostring(U.proj2D(sbs[2])))
            local c,s = U.segCross(U.proj2D(sas[1]),U.proj2D(sas[2]),U.proj2D(sbs[1]),U.proj2D(sbs[2]))
                    local c = U.segCross(U.proj2D(sas[1]),U.proj2D(sas[2]),U.proj2D(sbs[1]),U.proj2D(sbs[2]))
                        lo('?? cross_7_10:'..tostring(c))
                    out.acyan = {sas[1],sas[2], sbs[1],sbs[2]}
--                end
--                lo('?? if_cross:'..tostring(starta + dira*i)..':'..tostring(startb + dirb*j)..':'..tostring(c))
            if c and U.line2seg(
--                end
--                lo('?? if_cross:'..tostring(starta + dira*i)..':'..tostring(startb + dirb*j)..':'..tostring(c))
            if c and U.line2seg(
--                end
--                lo('?? if_cross:'..tostring(starta + dira*i)..':'..tostring(startb + dirb*j)..':'..tostring(c))
            if c and U.line2seg(
            ) then
--                    lo('?? l2sa:'..tostring(sa[1])..':'..tostring(sa[2])..':'..tostring(c))
--                    lo('?? l2sb:'..tostring(sb[1])..':'..tostring(sb[2])..':'..tostring(c))
            ) then
--                    lo('?? l2sa:'..tostring(sa[1])..':'..tostring(sa[2])..':'..tostring(c))
--                    lo('?? l2sb:'..tostring(sb[1])..':'..tostring(sb[2])..':'..tostring(c))
            ) then
--                    lo('?? l2sa:'..tostring(sa[1])..':'..tostring(sa[2])..':'..tostring(c))
--                    lo('?? l2sb:'..tostring(sb[1])..':'..tostring(sb[2])..':'..tostring(c))
--                    lo('?? l2sa:'..tostring(sa[1])..':'..tostring(sa[2])..':'..tostring(c))
--                    lo('?? l2sb:'..tostring(sb[1])..':'..tostring(sb[2])..':'..tostring(c))
--                    c = epos(rda, 0, sidea)
--                    lo('?? l2sa:'..tostring(sa[1])..':'..tostring(sa[2])..':'..tostring(c))
--                    lo('?? l2sb:'..tostring(sb[1])..':'..tostring(sb[2])..':'..tostring(c))
--                    c = epos(rda, 0, sidea)
--                    lo('?? l2sa:'..tostring(sa[1])..':'..tostring(sa[2])..':'..tostring(c))
--                    lo('?? l2sb:'..tostring(sb[1])..':'..tostring(sb[2])..':'..tostring(c))
--                    c = epos(rda, 0, sidea)
--                    c = epos(rda, 0, sidea)
--                    lo('?? borderCross:'..i..'/'..nsa..':'..j..'/'..nsb..':'..tostring(c)) --..':'..(startb + dirb*j)..':'..(startb + dirb*(j+1)))
--                    out.acyan[#out.acyan+1] = c
--[[
                    lo('?? borderCross:'..i..'/'..nsa..':'..j..'/'..nsb..':'..tostring(c)) --..':'..(startb + dirb*j)..':'..(startb + dirb*(j+1)))
                    out.avedit = {}
        local pmid,ei = onSide(rd, 'middle', db+(i)*pinstep)
            if dbg then lo('?? pin2sideD:'..i..':'..tostring(ei)) end
--        if not ei and math.abs(db+(i)*pinstep - rd.L) < U.small_dist then
        local pmid,d,ei = onSide(rd, side, db+(i)*pinstep)
            lo('?? pin2sideD:'..i..':'..tostring(ei))
        local un = (epos(rd.body,ei,side=='left' and 'right' or 'left') - epos(rd.body,ei,side)):normalized()
    end
--        lo('?? sideLine:'..tostring(rd)..':'..tostring(rdfr)..':'..tostring(rdto)..':'..tostring(cs)..':'..tostring(ias)..':'..tostring(ce))
--TODO: use pin2sideD
    end
--        lo('?? sideLine:'..tostring(rd)..':'..tostring(rdfr)..':'..tostring(rdto)..':'..tostring(cs)..':'..tostring(ias)..':'..tostring(ce))
--TODO: use pin2sideD
    end
--        lo('?? sideLine:'..tostring(rd)..':'..tostring(rdfr)..':'..tostring(rdto)..':'..tostring(cs)..':'..tostring(ias)..':'..tostring(ce))
--TODO: use pin2sideD
    end
--        lo('?? sideLine:'..tostring(rd)..':'..tostring(rdfr)..':'..tostring(rdto)..':'..tostring(cs)..':'..tostring(ias)..':'..tostring(ce))
--TODO: use pin2sideD
    end
--        lo('?? sideLine:'..tostring(rd)..':'..tostring(rdfr)..':'..tostring(rdto)..':'..tostring(cs)..':'..tostring(ias)..':'..tostring(ce))
--TODO: use pin2sideD
    end
--        lo('?? sideLine:'..tostring(rd)..':'..tostring(rdfr)..':'..tostring(rdto)..':'..tostring(cs)..':'..tostring(ias)..':'..tostring(ce))
--TODO: use pin2sideD
    if not dexit then dexit = default.rexit end
        lo('?? exitUp:'..tostring(dexit))
    -- distance between merge points
    if #anode ~= #apos then
--        lo('!! ERR_nodesUpdate:'..#anode..'<'..#apos..':'..tostring(frto))
--        return
--            U.dump(apos, '?? nodesUpdate:'..#anode..':'..#apos)
--                lo('?? e_UPD:'..junc.wexit) -- tostring(junc.aexit[i].body)..':'..#anode)
    for k,n in pairs(apos) do
--    local rd = bdesc.body
--        U.dump(bdesc, '>> toJunc:'..tostring(rd)..':'..bdesc.io)
    local anode = editor.getNodes(bdesc.body)
            p.z = 0
--                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
            editor.setNodePosition(bdesc.body, i-1, p)
            p.z = 0
--                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
            editor.setNodePosition(bdesc.body, i-1, p)
            p.z = 0
--                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
            editor.setNodePosition(bdesc.body, i-1, p)
local function junctionUpdate_(jdesc, yes)
        lo('>> junctionUpdate:'..tostring(yes))
    for i,b in pairs(jdesc.list) do
            for _,ie in pairs(b.aex) do
--                lo('?? ex_hide:'..tostring(jdesc.aexit[ie].body.hidden))
                jdesc.aexit[ie].body:setField('hidden', 0, yes and 'false' or 'true')
        b, b.io==1 and 'right' or 'left', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
--            lo('?? line4exit:'..tostring(aline[#aline].list[1])..':'..tostring(toSide(aline[#aline].list[1],b)..'/'..(b.w/2)))
--            lo('?? line4exit:'..tostring(aline[#aline].list[1])..':'..tostring(toSide(aline[#aline].list[1],b,b.io==1 and 'right' or 'left')..'/'..(b.w/2)))
        b, b.io==1 and 'right' or 'left', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
--            lo('?? line4exit:'..tostring(aline[#aline].list[1])..':'..tostring(toSide(aline[#aline].list[1],b)..'/'..(b.w/2)))
--            lo('?? line4exit:'..tostring(aline[#aline].list[1])..':'..tostring(toSide(aline[#aline].list[1],b,b.io==1 and 'right' or 'left')..'/'..(b.w/2)))
--            lo('?? line4exit:'..tostring(aline[#aline].list[1])..':'..tostring(toSide(aline[#aline].list[1],b)..'/'..(b.w/2)))
--            lo('?? line4exit:'..tostring(aline[#aline].list[1])..':'..tostring(toSide(aline[#aline].list[1],b,b.io==1 and 'right' or 'left')..'/'..(b.w/2)))
--            out.acyan = {aline[#aline].list[1]+vec3(0,0,forZ(aline[#aline].list[1]))}
--            lo('?? line4exit:'..tostring(aline[#aline].list[1])..':'..tostring(toSide(aline[#aline].list[1],b)..'/'..(b.w/2)))
--            lo('?? line4exit:'..tostring(aline[#aline].list[1])..':'..tostring(toSide(aline[#aline].list[1],b,b.io==1 and 'right' or 'left')..'/'..(b.w/2)))
--            out.acyan = {aline[#aline].list[1]+vec3(0,0,forZ(aline[#aline].list[1]))}
--            out.acyan = {aline[#aline].list[1]+vec3(0,0,forZ(aline[#aline].list[1]))}
--        lo('?? line1:'..tostring(aline[#aline].list))
    if #aline == 0 then
--        hide = false
--            lo('??^^^^^^^^^^^^ if_HIDE:'..tostring(hide))
    aline[#aline].on = hide ~= true
        b, b.io==1 and 'right' or 'left', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
--        lo('?? line2:'..tostring(aline[#aline].list))
--        lo('?? line4exit:'..tostring(aline[#aline]))
--        lo('?? line2:'..tostring(aline[#aline].list))
--        lo('?? line4exit:'..tostring(aline[#aline]))
--    aline[#aline].hide = hide
            b, b.io==1 and 'right' or 'left', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
    --        lo('?? line3:'..tostring(aline[#aline].list))
    --        lo('?? line4exit:'..tostring(aline[#aline]))
    --        lo('?? line3:'..tostring(aline[#aline].list))
    --        lo('?? line4exit:'..tostring(aline[#aline]))
        aline[#aline].on = hide ~= true
            desc, 'left', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
    --        lo('?? line4exit:'..tostring(aline[#aline]))
    --        lo('?? line4:'..tostring(aline[#aline].list))
    --        lo('?? line4exit:'..tostring(aline[#aline]))
    --        lo('?? line4:'..tostring(aline[#aline].list))
        aline[#aline].on = hide ~= true
    end
--        lo('<< line4exit:'..tostring(aline[#aline].on)..':'..tostring(hide))
    end
--        lo('<< line4exit:'..tostring(aline[#aline].on)..':'..tostring(hide))
--        pma = onSide(a,sidea,e2da[iea])
--        lo('?? at_A:'..iea..':'..pa:distance(epos(a.body,iea,sidea))..':'..tostring(pma)..':'..tostring(pa))
--        toMark({psa,psb}, 'blue', nil, 0.1, 0.5)
--        pma = onSide(a,sidea,e2da[iea])
--        lo('?? at_A:'..iea..':'..pa:distance(epos(a.body,iea,sidea))..':'..tostring(pma)..':'..tostring(pa))
--        toMark({psa,psb}, 'blue', nil, 0.1, 0.5)
        local dto,pto,ito = toSide(cb, edesc, 'middle')
                lo('?? if_SIDE:'..tostring(dfr)..':'..tostring(dto))
        dfr = e2de[ifr] + pfr:distance(epos(edesc.body,ifr)) + inset
        local dto,pto,ito = toSide(cb, edesc, 'middle')
                lo('?? if_SIDE:'..tostring(dfr)..':'..tostring(dto))
        dfr = e2de[ifr] + pfr:distance(epos(edesc.body,ifr)) + inset
    local da,db = desc.da,desc.db
--        lo('?? exitUp:'..tostring(da))
    -- distance between merge points
    end
            if dbg then lo('?? forExit_w:'..w..':'..da..':'..mergestepa..':'..tostring(desc.stepa)..':'..a.r..'/'..(a.r+a.w/2-w/2)) end
--            lo('??***************** forExit_for_a:'..sidea..':'..da..':'..mergestepa..':'..(w/2)..' L:'..a.L..':'..(da)..':'..cmargin)
    local da,db = desc.da,desc.db
        lo('>> forExit:'..tostring(isround)..':'..tostring(a.ij)..':'..tostring(b.r)..' da:'..da..' db:'..db..' dbg:'..tostring(dbg))
--        lo('?? exitUp:'..tostring(da))
    local da,db = desc.da,desc.db
        lo('>> forExit:'..tostring(isround)..':'..tostring(a.ij)..':'..tostring(b.r)..' da:'..da..' db:'..db..' dbg:'..tostring(dbg))
--        lo('?? exitUp:'..tostring(da))
    local da,db = desc.da,desc.db
        lo('>> forExit:'..tostring(isround)..':'..tostring(a.ij)..':'..tostring(b.r)..' da:'..da..' db:'..db..' dbg:'..tostring(dbg))
--        lo('?? exitUp:'..tostring(da))
    local da,db = desc.da,desc.db
        lo('>> forExit:'..tostring(isround)..':'..tostring(a.ij)..':'..tostring(b.r)..' da:'..da..' db:'..db..' dbg:'..tostring(dbg))
--        lo('?? exitUp:'..tostring(da))
        lo('>> forExit:'..tostring(isround)..':'..tostring(a.ij)..':'..tostring(b.r)..' da:'..da..' db:'..db..' dbg:'..tostring(dbg))
--        lo('?? exitUp:'..tostring(da))
    -- distance between merge points
    end
            if dbg then lo('?? forExit_w:'..tostring(b.io)..':'..w..' da:'..da..' db:'..db..'/'..b.L..':'..mergestepa..':'..tostring(desc.stepa)..':'..tostring(a.r)) end --..'/'..(a.r+a.w/2-w/2)) end
    list[#list+1] = onSide(a, sidea, da + (not a.r and a.io or 1)*mergestepa + dshift, w/2)
    end
            if dbg then lo('?? forExit_w:'..tostring(b.io)..':'..w..' da:'..da..' db:'..db..'/'..b.L..':'..mergestepa..':'..tostring(desc.stepa)..':'..tostring(a.r)) end --..'/'..(a.r+a.w/2-w/2)) end
    list[#list+1] = onSide(a, sidea, da + (not a.r and a.io or 1)*mergestepa + dshift, w/2)
    end
            if dbg then lo('?? forExit_w:'..tostring(b.io)..':'..w..' da:'..da..' db:'..db..'/'..b.L..':'..mergestepa..':'..tostring(desc.stepa)..':'..tostring(a.r)) end --..'/'..(a.r+a.w/2-w/2)) end
    list[#list+1] = onSide(a, sidea, da + (not a.r and a.io or 1)*mergestepa + dshift, w/2)
    list[#list+1] = onSide(b, sideb, db, w/2*cmargin)
--            lo('?? for_LAST3:'..tostring(list[#list]))
--            if dbg then toMark({list[#list], b.list[#b.list]}, 'red', nil, 0.1, 0.5) end
    end
        lo('>> junctionRound:'..r..':'..tostring(toupdate))
--    for i=1,1 do
                p.z = 0
    --                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
--                    editor.setNodePosition(bdesc.body, i-1, p)
                p.z = 0
    --                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
--                    editor.setNodePosition(bdesc.body, i-1, p)
                p.z = 0
    --                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
--                    editor.setNodePosition(bdesc.body, i-1, p)

--            lo('?? if_EXITS:'..tostring(b.aexo and #b.aexo or 0))
--[[
                eleft.da = (r+jdesc.round.w/2)*(ang == 0 and 2*math.pi or ang) - b.w/2 - edist
--                        lo('??^^^ if_upd:'..i..':'..tostring(toupdate)..' ang:'..ang..':'..edist..' da:'..eleft.da)
                if eleft.da < 0 then
--                    local pons = onSide(jdesc.round, 'right', 2*math.pi + eleft.da - 8, 0) -- math.pi*4/2*(r+jdesc.round.w/2), 0)
--                    lo('?? pons:'..tostring(pons))
--                    if pons then
                    local p = onSide(jdesc.round, 'right', (r+jdesc.round.w/2)*ang - b.w/2 - edist, 0)
                        lo('?? for_p:'..tostring(p))
                    out.avedit = {p}
                newline = sideLine(ex, 'right', rdfr, 'right', rdto, 'right', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
--                    lo('??_______________ if_line:'..i..':'..tostring(newline)..':'..tostring(ex)..':'..#br.aexi..':'..tostring(ex.aline and #ex.aline or 0))
            end
                newline = sideLine(ex, 'right', rdfr, 'right', rdto, 'right', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
--                    lo('??_______________ if_line:'..i..':'..tostring(newline)..':'..tostring(ex)..':'..#br.aexi..':'..tostring(ex.aline and #ex.aline or 0))
            end
                newline = sideLine(ex, 'right', rdfr, 'right', rdto, 'right', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
--                    lo('??_______________ if_line:'..i..':'..tostring(newline)..':'..tostring(ex)..':'..#br.aexi..':'..tostring(ex.aline and #ex.aline or 0))
            end

--                    lo('??_____ if_LINE:'..tostring(line)..':'..tostring(aline[1]))

--                    lo('??_____ if_LINE:'..tostring(line)..':'..tostring(aline[1]))
--            aline = line4exit(adec[b.aexi[1]], jdesc.round, b)
--                lo('?? al:'..tostring(aline))
    --            U.dump(aline, '?? line2:'..#adec[b.aexo[1]].aline)
    local jdesc = ajunc[cjunc]
            lo('??========================= jR:'..tostring(r)..':'..#jdesc.list[1].list..':'..tostring(jdesc.r))
--    if not r then
    local jdesc = ajunc[cjunc]
            lo('??========================= jR:'..tostring(r)..':'..#jdesc.list[1].list..':'..tostring(jdesc.r))
--    if not r then
    if not w then
            lo('?? jRw:'..tostring(jdesc.round and jdesc.round.w or nil))
        w = toupdate and jdesc.round.w or default.laneWidth*2
    end
        lo('>> junctionRound:'..r..':'..tostring(jdesc.round and jdesc.round.r or nil)..':'..tostring(toupdate)..':'..tostring(jdesc.list[1].listrad))
--    for i=1,1 do
    end
        lo('>> junctionRound:'..r..':'..tostring(jdesc.round and jdesc.round.r or nil)..':'..tostring(toupdate)..':'..tostring(jdesc.list[1].listrad))
--    for i=1,1 do
    end
        lo('>> junctionRound:'..r..':'..tostring(jdesc.round and jdesc.round.r or nil)..':'..tostring(toupdate)..':'..tostring(jdesc.list[1].listrad))
--    for i=1,1 do
    local ang -- = U.vang(vec3(1,0,0), jdesc.list[1].dir, true)
--        lo('?? for_ang0:'..tostring(ang)..':'..tostring(jdesc.list[1].dir))
    local list = {}
    local ang -- = U.vang(vec3(1,0,0), jdesc.list[1].dir, true)
--        lo('?? for_ang0:'..tostring(ang)..':'..tostring(jdesc.list[1].dir))
    local list = {}
                    p.z = 0
        --                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
    --                    editor.setNodePosition(bdesc.body, i-1, p)
                    p.z = 0
        --                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
    --                    editor.setNodePosition(bdesc.body, i-1, p)
                    p.z = 0
        --                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
    --                    editor.setNodePosition(bdesc.body, i-1, p)
        local ldesc = U._MODE == 'conf' and line4laneD(b, b.lane[1], jdesc.round.w/2) or line4lane(b, b.lane[1], jdesc.round.w/2)
--            U.dump(b.lane, '?? for_middle:'..i..':'..il..':'..tostring(#b.aline))
--            toMark(ldesc.list, 'yel')

--            lo('?? if_EXITS:'..tostring(b.aexo and #b.aexo or 0))
--[[
            end
--                lo('?? for_EX_right:'..i..':'..tostring(e.id))
            if e.id then
                b.aexo[_] = e.ind
--                    lo('?? eNEW:'..i..':'..tostring(e.ind))
            end
                eleft.da = (r+jdesc.round.w/2)*(ang == 0 and 2*math.pi or ang) - b.w/2 - edist
--                        lo('??^^^ if_upd:'..i..':'..tostring(toupdate)..' ang:'..ang..':'..edist..' da:'..eleft.da)
                if eleft.da < 0 then
--                    local pons = onSide(jdesc.round, 'right', 2*math.pi + eleft.da - 8, 0) -- math.pi*4/2*(r+jdesc.round.w/2), 0)
--                    lo('?? pons:'..tostring(pons))
--                    if pons then
--                    if i == 2 then eleft.w = 1 end
                    lo('??________________ pre_EXIT_left:'..i..':'..tostring(toupdate)..':'..tostring(i==2)..' w:'..eleft.w..':'..eleft.stepa)
                forExit(jdesc.round, b, eleft, true, i == 3)
--                    if i == 2 then eleft.w = 1 end
                    lo('??________________ pre_EXIT_left:'..i..':'..tostring(toupdate)..':'..tostring(i==2)..' w:'..eleft.w..':'..eleft.stepa)
                forExit(jdesc.round, b, eleft, true, i == 3)
                else
--                        lo('?? new_LEFT:'..i..':'..tostring(eleft.list and #eleft.list or nil))
                    decalUp(eleft)
                    local p = onSide(jdesc.round, 'right', (r+jdesc.round.w/2)*ang - b.w/2 - edist, 0)
                        lo('?? for_p:'..tostring(p))
                    out.avedit = {p}
                        {w=default.wline*1.5, mat=default.matline, lane={1,0}})
--                        lo('??***************** if_LINE:'..tostring(newline.list))
--                        toMark(newline.list, 'blue')
--                    newline = sideLine(ex, 'right', rdfr, 'right', rdto, 'right', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
    --                    lo('??_______________ if_line:'..i..':'..tostring(newline)..':'..tostring(ex)..':'..#br.aexi..':'..tostring(ex.aline and #ex.aline or 0))
                end
--                    newline = sideLine(ex, 'right', rdfr, 'right', rdto, 'right', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
    --                    lo('??_______________ if_line:'..i..':'..tostring(newline)..':'..tostring(ex)..':'..#br.aexi..':'..tostring(ex.aline and #ex.aline or 0))
                end
--                    newline = sideLine(ex, 'right', rdfr, 'right', rdto, 'right', {w=default.wline*1.5, mat=default.matline, lane={1,0}})
    --                    lo('??_______________ if_line:'..i..':'..tostring(newline)..':'..tostring(ex)..':'..#br.aexi..':'..tostring(ex.aline and #ex.aline or 0))
                end
                else
                    lo('!! ERR_no_EX_RIGHT:'..i..':'..tostring(br.aexo[1]))
                        toMark(br.list,'blue')

    --                    lo('??_____ if_LINE:'..tostring(line)..':'..tostring(aline[1]))

    --                    lo('??_____ if_LINE:'..tostring(line)..':'..tostring(aline[1]))
    --            aline = line4exit(adec[b.aexi[1]], jdesc.round, b)
    --                lo('?? al:'..tostring(aline))
        --            U.dump(aline, '?? line2:'..#adec[b.aexo[1]].aline)
    local junc = ajunc[cjunc]
        lo('>> vert2junc:'..tostring(cjunc)..':'..tostring(junc and junc.r or nil)) --..ajunc[cjunc].r) --..':'..tostring(abr[1].list[1])) --..':'..tostring(abr[1].ij))
--        junc.r = 10
    local junc = ajunc[cjunc]
        lo('>> vert2junc:'..tostring(cjunc)..':'..tostring(junc and junc.r or nil)) --..ajunc[cjunc].r) --..':'..tostring(abr[1].list[1])) --..':'..tostring(abr[1].ij))
--        junc.r = 10
    local junc = ajunc[cjunc]
        lo('>> vert2junc:'..tostring(cjunc)..':'..tostring(junc and junc.r or nil)) --..ajunc[cjunc].r) --..':'..tostring(abr[1].list[1])) --..':'..tostring(abr[1].ij))
--        junc.r = 10
    local junc = ajunc[cjunc]
        lo('>> vert2junc:'..tostring(cjunc)..':'..tostring(junc and junc.r or nil)) --..ajunc[cjunc].r) --..':'..tostring(abr[1].list[1])) --..':'..tostring(abr[1].ij))
--        junc.r = 10
        local bout = abr[i]
            lo('?? if_EXITS:'..tostring(bout.aexo and #bout.aexo or nil))
        if bout.aexo and #bout.aexo > 0 then
                decalUp(ldesc)
--                    lo('??*************** if_LINE_BODY:'..i..':'..k..':'..tostring(ldesc.body)..':'..tostring(ldesc.on))
                if ldesc.body and ldesc.on==false then
                decalUp(ldesc)
--                    lo('??*************** if_LINE_BODY:'..i..':'..k..':'..tostring(ldesc.body)..':'..tostring(ldesc.on))
                if ldesc.body and ldesc.on==false then
        end
--            lo('??_____________ for_ang:'..i..':'..U.vang(abr[i].dir,bin.dir,true)..':'..tostring(ex.ind))
        abr[i].aexo[#abr[i].aexo+1] = ex.ind or 0
--                U.dump(b.djrad, '??++++++++++++++ for_rad:'..i)
--                    lo('?? for_mid:'..tostring(b.ne)..':'..b.io..':'..b.w)
--- middle
--                        out.acyan = b.aline[#b.aline].list
    --            lo('?? if_body:'..tostring(b.aline[#b.aline].body))
            -- lanes right
--                    out.acyan[#out.acyan+1] = pe+vec3(0,0,forZ(pe))
--                    lo('?? ps_pe:'..tostring(ps)..':'..tostring(pe)..':'..ib..':'..ie)
--                    m1[#m1+1] = epos(b.body,ib)
--                    out.acyan[#out.acyan+1] = pe+vec3(0,0,forZ(pe))
--                    lo('?? ps_pe:'..tostring(ps)..':'..tostring(pe)..':'..ib..':'..ie)
--                    m1[#m1+1] = epos(b.body,ib)
    if not n then n = 4 end
        lo('>> junctionUp:'..tostring(pos)..':'..n)
    local step = default.rjunc --*2/3
            decalUp(b.aline[#b.aline])
    --            lo('?? if_body:'..tostring(b.aline[#b.aline].body))
            -- lanes right
local function forPlot(render)
        lo('>> forPlot:'..tableSize(amatch)..':'..tostring(render))
--        out.aplot = {}
            if not indrag then
                lo('??_ for_k:'..k..':'..tostring(amatch[k].to)..':'..tostring(amatch[k].fr))
            end
            if not indrag then
                lo('??_ for_k:'..k..':'..tostring(amatch[k].to)..':'..tostring(amatch[k].fr))
            end
                    if not indrag then
                        lo('??__ for_m:'..m..':'..dist..'/'..dmi..' t_m:'..tostring(atry[m])..' t_k:'..tostring(atry[k]))
                    end
                    if not indrag then
                        lo('??__ for_m:'..m..':'..dist..'/'..dmi..' t_m:'..tostring(atry[m])..' t_k:'..tostring(atry[k]))
                    end
                        end
                            lo('?? to_match:'..k..':'..m..':'..tostring(tomatch)..':'..tostring(atry[k])..':'..tostring(atry[m]))
                        if tomatch then
                        end
                            lo('?? to_match:'..k..':'..m..':'..tostring(tomatch)..':'..tostring(atry[k])..':'..tostring(atry[m]))
                        if tomatch then
                        end
                            lo('?? to_match:'..k..':'..m..':'..tostring(tomatch)..':'..tostring(atry[k])..':'..tostring(atry[m]))
                        if tomatch then
                            end
                                lo('?? pre_cross_imi:'..tostring(imi))
                            if imi then
                amatch[k].skip = true
                    U.dump(atry,'?? no_MATCH:'..k) --..':'..tostring(out.aplot))
--                    U.dump(amatch)
            n = n + 1
--            U.dump(atry, '?? atry:'..n..':'..tostring(out.aplot)..':'..tostring(match))
--            U.dump(amatch)
            n = n + 1
--            U.dump(atry, '?? atry:'..n..':'..tostring(out.aplot)..':'..tostring(match))
--            U.dump(amatch)
    if not indrag then
        U.dump(atry, '?? atry:'..n..':'..tostring(out.aplot)..':'..tostring(match))
        U.dump(amatch)
    if not indrag then
        U.dump(atry, '?? atry:'..n..':'..tostring(out.aplot)..':'..tostring(match))
        U.dump(amatch)
                            local sto = U.stamp({k,j},true)
                                lo('?? less:'..i..'>'..j..':'..sto..':'..tostring(atry[sto]))
                            if atry[sto] then
    local rdlen = roadLength(desc)
--        lo('?? for_len:'..tostring(rdlen)..':'..tostring(epos(a.body, 0, 'left'))..':'..tostring(epos(a.body, nea-1, 'left'))..':'..tostring(epos(a.body, nea, 'left')))
    local pmid = onSide(desc, 'middle', rdlen/2)
    local rdlen = roadLength(desc)
--        lo('?? for_len:'..tostring(rdlen)..':'..tostring(epos(a.body, 0, 'left'))..':'..tostring(epos(a.body, nea-1, 'left'))..':'..tostring(epos(a.body, nea, 'left')))
    local pmid = onSide(desc, 'middle', rdlen/2)
    local rdlen = roadLength(desc)
--        lo('?? for_len:'..tostring(rdlen)..':'..tostring(epos(a.body, 0, 'left'))..':'..tostring(epos(a.body, nea-1, 'left'))..':'..tostring(epos(a.body, nea, 'left')))
    local pmid = onSide(desc, 'middle', rdlen/2)
    local rdlen = roadLength(desc)
--        lo('?? for_len:'..tostring(rdlen)..':'..tostring(epos(a.body, 0, 'left'))..':'..tostring(epos(a.body, nea-1, 'left'))..':'..tostring(epos(a.body, nea, 'left')))
    local pmid = onSide(desc, 'middle', rdlen/2)
--        out.avedit = {p,p+v} -- {pc} -- {epos(a.body, nea-1, 'middle'), list[#list]}
--        lo('?? to_side:'..tostring(pc))
    local epsa = list[2]:distance(list[1])/aend:distance(list[1])
    list[#list-1] = spb + (pb-pcb)*epsb
--        lo('?? ends2:'..tostring(list[2])..':'..tostring(list[#list-1]))
--        out.avedit = {list[2], pb, pb+vb} -- list[#list-1]}
    list[#list-1] = spb + (pb-pcb)*epsb
--        lo('?? ends2:'..tostring(list[2])..':'..tostring(list[#list-1]))
--        out.avedit = {list[2], pb, pb+vb} -- list[#list-1]}
    local jdesc = ajunc[ind]
--        U.dump(ajunc, '>> junctionDown:'..tostring(ind)..':'..#ajunc)
    for i,b in pairs(jdesc.list) do
local function junctionUpdate(jdesc, show)
        lo('>> junctionUpdate:'..tostring(show))
--    for i=1,1 do
                end
--                    lo('??+++++++++++++++++++++++++++ line_hide:'..#b.aline..':'..tostring(tohide)..':'..tostring(b.aexo[1]))
--                for il,d in pairs(b.aline) do
                end
--                    lo('??+++++++++++++++++++++++++++ line_hide:'..#b.aline..':'..tostring(tohide)..':'..tostring(b.aexo[1]))
--                for il,d in pairs(b.aline) do
                        p.z = 0
            --                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
    --                    editor.setNodePosition(bdesc.body, i-1, p)
                        p.z = 0
            --                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
    --                    editor.setNodePosition(bdesc.body, i-1, p)
                        p.z = 0
            --                lo('?? for_node:'..i..':'..tostring(n.pos)..'>'..tostring(p)..' dir:'..tostring(bdesc.dir))
    --                    editor.setNodePosition(bdesc.body, i-1, p)
            if show then
                    lo('??++++++++++++++++++++++++ junctionUpdate_render_branch:'..i..':'..tostring(show))
                for _,idec in pairs(b.aexo) do
                    if e and isrelevant then
                            lo('?? for_exito:'.._..':'..tostring(e.id))
--- exit nodes
                            for k,l in pairs(aline) do
    --                                lo('?? for_LINE:'..i..':'..k..':'..tostring(l.list and #l.list or nil))
                                if e.aline[k] then
        --                                e.aline[k].body:setPosition(e.aline[k].body:getPosition())
                                            lo('??+++++++ new_BODY:'..i..':'..k..':'..tostring(e.aline[k].body))
                                    end
                if U._MODE == 'conf' then
                        lo('?? if_WIDTH:'..i..'/'..#jdesc.list..':'..tostring(jdesc.list[i].w)..':'..tostring(U.mod(i+1, jdesc.list).w))
                    ldesc = line4laneD(b, b.lane[1], U.mod(i+1, jdesc.list).w/2)
                if U._MODE == 'conf' then
                        lo('?? if_WIDTH:'..i..'/'..#jdesc.list..':'..tostring(jdesc.list[i].w)..':'..tostring(U.mod(i+1, jdesc.list).w))
                    ldesc = line4laneD(b, b.lane[1], U.mod(i+1, jdesc.list).w/2)
local function junctionUp_(pos, n)
        lo('>> junctionUp:'..tostring(pos)..':'..n)
    local step = default.rjunc
            out.avedit[#out.avedit+1] = pleft
            lo('?? for_lanes:'..tostring(rd.lanesLeft)..':'..tostring(pleft))
            local pright = onSide(rd, ' right', 10, laneWidth/2)
            out.avedit[#out.avedit+1] = pleft
            lo('?? for_lanes:'..tostring(rd.lanesLeft)..':'..tostring(pleft))
            local pright = onSide(rd, ' right', 10, laneWidth/2)
        if (p - vec3(0, 0, 0)):length() < 300 then
            lo('?? CC0:'..tostring(p))
        end
        local selectedObject = scenetree.findObjectById(editor.selection.object[i])
            lo('?? SO:'..tostring(selectedObject:getClassName()))
        if selectedObject and selectedObject:getClassName() == "DecalRoad" then
              croad = scenetree.findObjectById(editor.selection.object[i])
                    lo('?? R_seld:'..tostring(croad))
              break
    end
--        lo('?? hmapChange:'..tostring(p)..':'..h)
    tb:setHeightWs(p, h)
    if croad then
        lo('?? decal.restore:'..tostring(croad:getPosition()))
--        croad:setPosition(croad:getPosition())

lo('?? deacl:'..tostring(tableSize(rdlist)))
    end
        lo('?? ter2road:'..tostring(cpick)..':'..tostring(cid))
    if cid then cpick = cid end
    end
        lo('?? ter2road:'..tostring(cpick)..':'..tostring(cid))
    if cid then cpick = cid end
    if not cpick then return end
--    U.dump(adec, '>> ter2road:'..tostring(#adec or #adec)..':'..tostring(cpick)..':'..#editor.getAllRoads())
    if not cpick then return end
--    U.dump(adec, '>> ter2road:'..tostring(#adec or #adec)..':'..tostring(cpick)..':'..#editor.getAllRoads())
        croad = scenetree.findObjectById(cpick)
        --            lo('>> ter2road:'..tostring(editor.selection.object[1]))
        anode = editor.getNodes(croad)
        anode = editor.getNodes(croad)
                lo('?? ter2road:'..tableSize(adec)) --..':'..tostring(adec[1].list[1])..':'..croad:getEdgeCount()..':'..tostring(anode[2].width))
        if #U.index(conformed, cpick) == 0 then
        anode = editor.getNodes(croad)
                lo('?? ter2road:'..tableSize(adec)) --..':'..tostring(adec[1].list[1])..':'..croad:getEdgeCount()..':'..tostring(anode[2].width))
        if #U.index(conformed, cpick) == 0 then
--        if (r.list[1] - anode[1].pos):length() < 0.1 and #r.list == #anode then
--            lo('?? match1:'..i..':'..tostring(r[1])..':'..tostring(anode[1].pos)..' n1:'..#r..' n2:'..#anode)
            cdec = i
--        if (r.list[1] - anode[1].pos):length() < 0.1 and #r.list == #anode then
--            lo('?? match1:'..i..':'..tostring(r[1])..':'..tostring(anode[1].pos)..' n1:'..#r..' n2:'..#anode)
            cdec = i
    --
--            U.dump(across[cdec], '?? ter2road: cdec='..cdec..' nodes:'..tostring(#adec[cdec]))
--            U.dump(across[cdec], '?? ter2road: cdec='..cdec..' nodes:'..tostring(#adec[cdec]))
--            U.dump(across[cdec], '?? ter2road: cdec='..cdec..' nodes:'..tostring(#adec[cdec]))
--            U.dump(across[cdec], '?? ter2road: cdec='..cdec..' nodes:'..tostring(#adec[cdec]))
            U.dump(out.avedit)
    local rcross = 5*croad:getNodeWidth(0)/3.5 -- radius of pinned around crossroad
            U.dump(acp, '?? acp:'..anode[1].width..':'..tostring(anode[1].pos)..' rcross:'..rcross)
    local dpin = 20 -- distance between pins
        end
--                if i < 5 then lo('?? for_d:'..i..':'..cdist..':'..tostring(epos)) end
        if prepos then
    for i = 0,nsec-1 do
--            lo('?? for_i:'..i..':'..tostring(aedist[i+1])..' cint:'..cint..' acp:'..tostring(acp[cint])..':'..tostring(andist[acp[cint]]))
--            lo('?? for_e:'..i..':'..cint..':'..tostring(acp[cint]))
    for i = 0,nsec-1 do
--            lo('?? for_i:'..i..':'..tostring(aedist[i+1])..' cint:'..cint..' acp:'..tostring(acp[cint])..':'..tostring(andist[acp[cint]]))
--            lo('?? for_e:'..i..':'..cint..':'..tostring(acp[cint]))
    for i = 0,nsec-1 do
--            lo('?? for_i:'..i..':'..tostring(aedist[i+1])..' cint:'..cint..' acp:'..tostring(acp[cint])..':'..tostring(andist[acp[cint]]))
--            lo('?? for_e:'..i..':'..cint..':'..tostring(acp[cint]))
--            lo('?? for_i:'..i..':'..tostring(aedist[i+1])..' cint:'..cint..' acp:'..tostring(acp[cint])..':'..tostring(andist[acp[cint]]))
--            lo('?? for_e:'..i..':'..cint..':'..tostring(acp[cint]))
        if acp[cint] and math.abs(aeinfo[i+1].d - andist[acp[cint]]) < rcross then
                local p = croad:getMiddleEdgePosition(i)
--                    lo('?? for_p:'..i..':'..tostring(p)..':'..aepin[i])
                    p.z = aepin[#aepin][2]
--                    out.apick[#out.apick + 1] = p -- vec3(p.x,p.y,aepin[#aepin][2])
--                    lo('?? for_pin1:'..#aepin..':'..tostring(p)..':'..aeinfo[i+1].d)
        else
                end
--                    lo('?? for_pin2:'..#aepin..':'..tostring(p)..':'..aeinfo[i+1].d)
            end
                            local pin1,pin2 = aepin[aeinfo[imi].ipin][1],aepin[aeinfo[imi].ipin+1][1]
                        --                                        U.dump(aeinfo[imi], '?? dt: ie:'..imi..':'..ap[y][x][1]..':'..tostring(t)..':'..tostring(aeinfo[imi].pos)..':'..tostring(p1)..':'..tostring(p2)..' pin1:'..pin1..' pin2:'..pin2..' d1:'..aeinfo[pin1].d..' d2:'..aeinfo[pin2].d)
                            local fromOrigin = aeinfo[imi].d + (aeinfo[imi+1].d - aeinfo[imi].d)*p1
                            local pin1,pin2 = aepin[aeinfo[imi].ipin][1],aepin[aeinfo[imi].ipin+1][1]
                        --                                        U.dump(aeinfo[imi], '?? dt: ie:'..imi..':'..ap[y][x][1]..':'..tostring(t)..':'..tostring(aeinfo[imi].pos)..':'..tostring(p1)..':'..tostring(p2)..' pin1:'..pin1..' pin2:'..pin2..' d1:'..aeinfo[pin1].d..' d2:'..aeinfo[pin2].d)
                            local fromOrigin = aeinfo[imi].d + (aeinfo[imi+1].d - aeinfo[imi].d)*p1
                            local pin1,pin2 = aepin[aeinfo[imi].ipin][1],aepin[aeinfo[imi].ipin+1][1]
                        --                                        U.dump(aeinfo[imi], '?? dt: ie:'..imi..':'..ap[y][x][1]..':'..tostring(t)..':'..tostring(aeinfo[imi].pos)..':'..tostring(p1)..':'..tostring(p2)..' pin1:'..pin1..' pin2:'..pin2..' d1:'..aeinfo[pin1].d..' d2:'..aeinfo[pin2].d)
                            local fromOrigin = aeinfo[imi].d + (aeinfo[imi+1].d - aeinfo[imi].d)*p1
                            local pin1,pin2 = aepin[aeinfo[imi].ipin][1],aepin[aeinfo[imi].ipin+1][1]
                        --                                        U.dump(aeinfo[imi], '?? dt: ie:'..imi..':'..ap[y][x][1]..':'..tostring(t)..':'..tostring(aeinfo[imi].pos)..':'..tostring(p1)..':'..tostring(p2)..' pin1:'..pin1..' pin2:'..pin2..' d1:'..aeinfo[pin1].d..' d2:'..aeinfo[pin2].d)
                            local fromOrigin = aeinfo[imi].d + (aeinfo[imi+1].d - aeinfo[imi].d)*p1
    if cid then cpick = nil end
        lo('<< ter2road:'..#out.avedit..':'..#shmap..':'..aeinfo[#aeinfo].d) --....croad:getField("Material", "")..':'..tostring(croad:getPosition()))
--        U.dump(ap, '?? asq:'..tostring(asq[1])..':'..tableSize(ap))
        lo('<< ter2road:'..#out.avedit..':'..#shmap..':'..aeinfo[#aeinfo].d) --....croad:getField("Material", "")..':'..tostring(croad:getPosition()))
--        U.dump(ap, '?? asq:'..tostring(asq[1])..':'..tableSize(ap))
end
                    if imi == nil then
--                        U.dump(ae,'?? for_IMI:'..i..':'..tostring(imi)..':'..#ae..':'..tostring(t))
--                        out.apoint[#out.apoint+1] = t
                    if imi == nil then
--                        U.dump(ae,'?? for_IMI:'..i..':'..tostring(imi)..':'..#ae..':'..tostring(t))
--                        out.apoint[#out.apoint+1] = t
        end
--            lo(i..':'..tostring(epos)..'/'..tostring(anode[acp[cint] ].pos))
        if (epos-anode[acp[cint] ].pos):length() < 0.02 then
        end
--            lo(i..':'..tostring(epos)..'/'..tostring(anode[acp[cint] ].pos))
        if (epos-anode[acp[cint] ].pos):length() < 0.02 then
--        U.dump(andist, '?? ndist:')
--        lo('?? EN:'..tostring(croad:getMiddleEdgePosition(nsec-1))..':'..tostring(anode[#anode].pos))
--        lo('?? EN:'..tostring(croad:getMiddleEdgePosition(0))..':'..tostring(anode[1].pos))
--        U.dump(andist, '?? ndist:')
--        lo('?? EN:'..tostring(croad:getMiddleEdgePosition(nsec-1))..':'..tostring(anode[#anode].pos))
--        lo('?? EN:'..tostring(croad:getMiddleEdgePosition(0))..':'..tostring(anode[1].pos))
--        lo('?? EN:'..tostring(croad:getMiddleEdgePosition(nsec-1))..':'..tostring(anode[#anode].pos))
--        lo('?? EN:'..tostring(croad:getMiddleEdgePosition(0))..':'..tostring(anode[1].pos))
--        lo('?? EN:'..tostring(croad:getMiddleEdgePosition(nsec-1))..':'..tostring(anode[#anode].pos))
--        lo('?? EN:'..tostring(croad:getMiddleEdgePosition(0))..':'..tostring(anode[1].pos))

--        U.dump(anode[1], '?? for_adec:'..tostring(adec[1][1]))
--[[
        local epos = rd:getMiddleEdgePosition(i)
--            if dbg then lo('?? nn:'..i..':'..tostring(nxtnode)..'/'..#anode) end
        if (epos - anode[nxtnode].pos):length() < 0.02 then
    local c = ((D.ui.laneL + D.ui.laneR)/2 - D.ui.laneL)/(D.ui.laneL + D.ui.laneR)*2
        lo('?? middleUp_c:'..c..':'..tostring(D.ui.middleYellow))
    local v
    rd.name = 'line_'..cpick..'_'..rd:getID()   --:registerObject('road'..'_'..'13213111')
        lo('<< middleUp____:'..tostring(dline[cpick..'_middle'].name)..':'..tostring(rd.obj))
    groupLines:add(rd.obj)
    rd.name = 'line_'..cpick..'_'..rd:getID()   --:registerObject('road'..'_'..'13213111')
        lo('<< middleUp____:'..tostring(dline[cpick..'_middle'].name)..':'..tostring(rd.obj))
    groupLines:add(rd.obj)
    local function forEnd(ndi)
        lo('?? forEnd:'..tostring(across and #across or 'NONE')..'/'..tostring(cdec))
        if not cdec then return end
    local function forEnd(ndi)
        lo('?? forEnd:'..tostring(across and #across or 'NONE')..'/'..tostring(cdec))
        if not cdec then return end
        local function forSide(br, flip)
--                U.dump(br, '>> forSide:'..tostring(flip)..':'..us.rdi..'>'..br.rdi)
            local rdthem = adec[br.rdi].body

--                lo('?? ends: us='..usfr..'>'..usto..' them='..themfr..'>'..themto) --..':'..tostring(rdthem)..':'..(bright.ndi-bright.fr)..':'..((bright.ndi-bright.fr)*20)..':'..bright.fr..':'..(bright.fr + (bright.ndi-bright.fr)*20))
                out.avedit = {}
--                    out.apick[#out.apick + 1] = rdthem:getRightEdgePosition(cjmi)
    --                lo('?? cdmi:'..i..':'..cdmi..':'..tostring(rdthem:getLeftEdgePosition(jmi)))
    --                out.avedit = {croad:getRightEdgePosition(i), rdthem:getLeftEdgePosition(jmi)}
            end
--                lo('?? mi: us='..tostring(imi)..':'..tostring(dmi)..' them:'..tostring(jmi))
    --            if true then return end
            end
--                lo('?? mi: us='..tostring(imi)..':'..tostring(dmi)..' them:'..tostring(jmi))
    --            if true then return end
            end
--                lo('?? mi: us='..tostring(imi)..':'..tostring(dmi)..' them:'..tostring(jmi))
    --            if true then return end
            )
--                lo('?? uth:'..tostring(us1)..':'..tostring(us2)..':'..tostring(them1)..':'..tostring(them2)..':')
                out.avedit = {us1, us2, them1, them2}
            )
--                lo('?? uth:'..tostring(us1)..':'..tostring(us2)..':'..tostring(them1)..':'..tostring(them2)..':')
                out.avedit = {us1, us2, them1, them2}
            )
--                lo('?? uth:'..tostring(us1)..':'..tostring(us2)..':'..tostring(them1)..':'..tostring(them2)..':')
                out.avedit = {us1, us2, them1, them2}
            )
--                lo('?? uth:'..tostring(us1)..':'..tostring(us2)..':'..tostring(them1)..':'..tostring(them2)..':')
                out.avedit = {us1, us2, them1, them2}
            local ie = atEdge(p, rdobj)
--                lo('?? mm: p='..tostring(p)..':'..tostring(imi)..':'..jmi..':'..dmi..':'..x..':'..y..' ie:'..tostring(ie))
    --            lo('?? p:'..tostring(p)..':'..tostring(ie))
            local ie = atEdge(p, rdobj)
--                lo('?? mm: p='..tostring(p)..':'..tostring(imi)..':'..jmi..':'..dmi..':'..x..':'..y..' ie:'..tostring(ie))
    --            lo('?? p:'..tostring(p)..':'..tostring(ie))
            local ie = atEdge(p, rdobj)
--                lo('?? mm: p='..tostring(p)..':'..tostring(imi)..':'..jmi..':'..dmi..':'..x..':'..y..' ie:'..tostring(ie))
    --            lo('?? p:'..tostring(p)..':'..tostring(ie))
--                lo('?? mm: p='..tostring(p)..':'..tostring(imi)..':'..jmi..':'..dmi..':'..x..':'..y..' ie:'..tostring(ie))
    --            lo('?? p:'..tostring(p)..':'..tostring(ie))
--                out.apick[#out.apick + 1] = p
--                lo('?? mm: p='..tostring(p)..':'..tostring(imi)..':'..jmi..':'..dmi..':'..x..':'..y..' ie:'..tostring(ie))
    --            lo('?? p:'..tostring(p)..':'..tostring(ie))
--                out.apick[#out.apick + 1] = p
--    local pRe,iee,pLe,iele = forEnd(#anode)
--            lo('?? sideUp.ending:'..tostring(pR)..':'..tostring(pL)) --..':'..tostring(pLe)..':'..tostring(iele))
    local n2e
--    local pRe,iee,pLe,iele = forEnd(#anode)
--            lo('?? sideUp.ending:'..tostring(pR)..':'..tostring(pL)) --..':'..tostring(pLe)..':'..tostring(iele))
    local n2e
--    local pRe,iee,pLe,iele = forEnd(#anode)
--            lo('?? sideUp.ending:'..tostring(pR)..':'..tostring(pL)) --..':'..tostring(pLe)..':'..tostring(iele))
    local n2e
--    local pRe,iee,pLe,iele = forEnd(#anode)
--            lo('?? sideUp.ending:'..tostring(pR)..':'..tostring(pL)) --..':'..tostring(pLe)..':'..tostring(iele))
    local n2e
            if i < 10 then
--                lo('?? for_e:'..i..':'..nxtnode..':'..tostring(epos)..':'..tostring(anode[nxtnode].pos))
            end
            if i < 10 then
--                lo('?? for_e:'..i..':'..nxtnode..':'..tostring(epos)..':'..tostring(anode[nxtnode].pos))
            end
            local en2 = math.ceil((n2e[ipre + 2].e + ie)/2)
--                lo('?? distR:'..tostring(ipre)..':'..n2e[2].e..':'..ie..' 12:'..d12..' 23:'..d23..':'..en2)
            listr[1] = pR
            local en2 = math.floor((n2e[ipre + 2].e + iel)/2) - 1
--                lo('?? distL:'..tostring(ipre)..':'..n2e[2].e..':'..iel..' 12:'..d12..' 23:'..d23..':'..en2)
            list[1] = pL
        local w = (rdr:getRightEdgePosition(i) - rdr:getleftEdgePosition(i)):length()
        lo('?? for_p:'..tostring(p))
    end
    rdobj:setField("material", 0, mat)
        lo('??***************** dec.matApply:'..mat..':'..tostring(o)..':'..tostring(cpick)..':'..tostring(rdobj))
    if o then
    rdobj:setField("material", 0, mat)
        lo('??***************** dec.matApply:'..mat..':'..tostring(o)..':'..tostring(cpick)..':'..tostring(rdobj))
    if o then
    rdobj:setField("material", 0, mat)
        lo('??***************** dec.matApply:'..mat..':'..tostring(o)..':'..tostring(cpick)..':'..tostring(rdobj))
    if o then
            if i < 10 then
--                lo('?? for_e:'..i..':'..nxtnode..':'..tostring(epos)..':'..tostring(anode[nxtnode].pos))
            end
            if i < 10 then
--                lo('?? for_e:'..i..':'..nxtnode..':'..tostring(epos)..':'..tostring(anode[nxtnode].pos))
            end
--        if cpick then
--            lo('?? forRoad:'..tostring(cpick))
--            cpick = nil
    end
--        lo('?? ifR:'..tostring(wma)..'/'..r..':'..(r >= wma*2/3))
--        lo('<< ifRound:'..r..'/'..wma..':'..(wma*3/2))
    local jdesc = ajunc[cjunc]
--        lo('?? D.onVal:'..key..':'..tostring(val))
        if not incontrol then lo('?? D.onVal:'..key..':'..tostring(val)..':'..tostring(cjunc)..':'..tostring(incontrol)) end
--        lo('?? D.onVal:'..key..':'..tostring(val))
        if not incontrol then lo('?? D.onVal:'..key..':'..tostring(val)..':'..tostring(cjunc)..':'..tostring(incontrol)) end
    if incontrol then
--        lo('?? D.onVal:'..key..':'..tostring(val))
        if not incontrol then lo('?? D.onVal:'..key..':'..tostring(val)..':'..tostring(cjunc)..':'..tostring(incontrol)) end
    if incontrol then
--        lo('?? D.onVal:'..key..':'..tostring(val))
        if not incontrol then lo('?? D.onVal:'..key..':'..tostring(val)..':'..tostring(cjunc)..':'..tostring(incontrol)) end
    if incontrol then
            end
                lo('?? for_B:'..i..':'..b.ind..':'..b.io..':'..#b.list..':'..tostring(b.list[1])..':'..tostring(b.list[2])..':'..tostring(ajunc[cjunc].p))
            b.dir = (b.io==1 and (b.list[2]-b.list[1]) or (b.list[#b.list-1]-b.list[#b.list])):normalized()
            end
                lo('?? for_B:'..i..':'..b.ind..':'..b.io..':'..#b.list..':'..tostring(b.list[1])..':'..tostring(b.list[2])..':'..tostring(ajunc[cjunc].p))
            b.dir = (b.io==1 and (b.list[2]-b.list[1]) or (b.list[#b.list-1]-b.list[#b.list])):normalized()
            end
                lo('?? for_B:'..i..':'..b.ind..':'..b.io..':'..#b.list..':'..tostring(b.list[1])..':'..tostring(b.list[2])..':'..tostring(ajunc[cjunc].p))
            b.dir = (b.io==1 and (b.list[2]-b.list[1]) or (b.list[#b.list-1]-b.list[#b.list])):normalized()
            b.lane = {lane[1],lane[2]}
--                U.dump(b.lane,'??__________________________ for_rd_w:'..tostring(w)..':'..nln..':'..math.random(1,nln-1)..':'..tostring(ajunc[cjunc].p)..':'..tostring(b.list[1]))
            b.aexi={}
            b.lane = {lane[1],lane[2]}
--                U.dump(b.lane,'??__________________________ for_rd_w:'..tostring(w)..':'..nln..':'..math.random(1,nln-1)..':'..tostring(ajunc[cjunc].p)..':'..tostring(b.list[1]))
            b.aexi={}
            b.lane = {lane[1],lane[2]}
--                U.dump(b.lane,'??__________________________ for_rd_w:'..tostring(w)..':'..nln..':'..math.random(1,nln-1)..':'..tostring(ajunc[cjunc].p)..':'..tostring(b.list[1]))
            b.aexi={}
            end
                lo('?? if_CONF:'..i..':'..tostring(toconf))
            if toconf then
            if not ajunc[cjunc] then return end
                lo('?? junc_CONF:'..cjunc..':'..#ajunc[cjunc].list..' r:'..tostring(ajunc[cjunc].r))
            local rma = ajunc[cjunc].r or 0
]]
--                lo('?? if_EX:'..tostring())
            road2ter(nil) --,nil,true)
        jdesc.round.w = val
--            lo('?? jdesc_w:'..tostring(jdesc.round.w))
--        junctionRound(ajunc[cjunc].round.r, val)
    elseif key == 'branch_n' then
            lo('?? branch_n:'..val..':'..tostring(cjunc)..':'..tostring(indrag))
        local p = ajunc[cjunc].p
    elseif key == 'branch_n' then
            lo('?? branch_n:'..val..':'..tostring(cjunc)..':'..tostring(indrag))
        local p = ajunc[cjunc].p
    elseif key == 'junction_round' then
            lo('?? onVal_junction_round:'..tostring(jdesc.r))
--        if not D.ifRound(jdesc.r, jdesc.list) then return end
local function toTarget(ang, throttle) --cpos, cvel)
--        lo('?? toTarget:'..tostring(ang)..':'..tostring(throttle))
    if not veh then return end
local function toTarget(ang, throttle) --cpos, cvel)
--        lo('?? toTarget:'..tostring(ang)..':'..tostring(throttle))
    if not veh then return end
--    if true then return end
--        lo('>> toTarget:'..tostring(car.target)..':'..tostring(ang))
--    veh:queueLuaCommand('ai.driveToTarget("'..car.target.x..'_'..car.target.y..'_'..car.pos.x..'_'..car.pos.y..'_'..car.vel.y..'_'..car.vel.y..'",0.1,0,0.2,"1")')
--    if true then return end
--        lo('>> toTarget:'..tostring(car.target)..':'..tostring(ang))
--    veh:queueLuaCommand('ai.driveToTarget("'..car.target.x..'_'..car.target.y..'_'..car.pos.x..'_'..car.pos.y..'_'..car.vel.y..'_'..car.vel.y..'",0.1,0,0.2,"1")')
    if not rd then return end
        lo('?? forBranch:'..tostring(rd.ij and rd.ij[2] or nil)..' idec:'..rd.ind..':'..tostring(side)) --..':'..ajunc[rd.ij[1]].list[rd.ij[2]].ind..':'..tostring(rd.dir))
    if not side then side = 'middle' end
    if not rd then return end
        lo('?? forBranch:'..tostring(rd.ij and rd.ij[2] or nil)..' idec:'..rd.ind..':'..tostring(side)) --..':'..ajunc[rd.ij[1]].list[rd.ij[2]].ind..':'..tostring(rd.dir))
    if not side then side = 'middle' end
    if not rd then return end
        lo('?? forBranch:'..tostring(rd.ij and rd.ij[2] or nil)..' idec:'..rd.ind..':'..tostring(side)) --..':'..ajunc[rd.ij[1]].list[rd.ij[2]].ind..':'..tostring(rd.dir))
    if not side then side = 'middle' end
local function toExit(side)
        lo('>> toExit:'..tostring(car.target)..':'..tostring(car.target and car.target.rd or nil))
    if not car.target then return end
local function toExit(side)
        lo('>> toExit:'..tostring(car.target)..':'..tostring(car.target and car.target.rd or nil))
    if not car.target then return end
    if not rd or not rd.aexo then return end
        lo('?? toExit:'..tostring(car.target)..':'..tostring(#rd.aexo))
--        U.dump(rd, '>> toExit:')
    if not rd or not rd.aexo then return end
        lo('?? toExit:'..tostring(car.target)..':'..tostring(#rd.aexo))
--        U.dump(rd, '>> toExit:')
    end
        U.dump(car.target.exit,'<< toExit:'..tostring(dmi)..':'..#rd.aexo)
    return false
    local newlane = car.target.lane+dir
        lo('?? toLane:'..tostring(toend)..':'..tostring(newlane)..':'..car.target.rd.ind)
    if toend > default.react_time then
    local newlane = car.target.lane+dir
        lo('?? toLane:'..tostring(toend)..':'..tostring(newlane)..':'..car.target.rd.ind)
    if toend > default.react_time then
        ie = fromEdge(car.target.rd, ie, car.target.side, default.react_time*car.vel:length())
            lo('?? ie:'..tostring(ie))
        if ie then
    local dircar = veh:getDirectionVector()
        lo('>>^^^^^^^^^^ forTarget:'..tostring(dircar)..':'..tostring(car.target and car.target.p)..':'..tostring(car.target and car.target.rd and car.target.rd.ind..'_'..car.target.side or nil))
    local dmi,ijmi = math.huge
    local dircar = veh:getDirectionVector()
        lo('>>^^^^^^^^^^ forTarget:'..tostring(dircar)..':'..tostring(car.target and car.target.p)..':'..tostring(car.target and car.target.rd and car.target.rd.ind..'_'..car.target.side or nil))
    local dmi,ijmi = math.huge
    local dircar = veh:getDirectionVector()
        lo('>>^^^^^^^^^^ forTarget:'..tostring(dircar)..':'..tostring(car.target and car.target.p)..':'..tostring(car.target and car.target.rd and car.target.rd.ind..'_'..car.target.side or nil))
    local dmi,ijmi = math.huge
--            end
--                lo('?? for_rd:'..tostring(rd.body)..':'..tostring(rd.ind)..':'..#rd.list)
            if rd and rd.ij and rd.body and rd.body:getNodeWidth(0) > 1.5 then -- and rd.body:containsPoint(car.pos) then
--            end
--                lo('?? for_rd:'..tostring(rd.body)..':'..tostring(rd.ind)..':'..#rd.list)
            if rd and rd.ij and rd.body and rd.body:getNodeWidth(0) > 1.5 then -- and rd.body:containsPoint(car.pos) then
            end
    --                lo('?? for_rd:'..i..':'..tostring(dmi))
            ::continue::
        if ijmi then
                U.dump(ijmi, '?? cand_found:'..tostring(dmi)..':'..adec[ijmi[1]].id..':'..tostring(car.pos))
                local icheck = 43
        if ijmi then
                U.dump(ijmi, '?? cand_found:'..tostring(dmi)..':'..adec[ijmi[1]].id..':'..tostring(car.pos))
                local icheck = 43
                if false and ijmi[1] ~= icheck then
                        lo('?? wrongWay:'..tostring(car.pos))
                    for i,p in pairs(adec[ijmi[1] ].list) do
                    for i,p in pairs(adec[icheck].list) do
                        lo('?? dist_check:'..icheck..':'..car.pos:distance(p)..':'..tostring(car.pos)..':'..tostring(p))
                    end
                    for i,p in pairs(adec[icheck].list) do
                        lo('?? dist_check:'..icheck..':'..car.pos:distance(p)..':'..tostring(car.pos)..':'..tostring(p))
                    end
            local ie = p2e(car.pos, rd)
            local side = car.pos:distance(epos(rd.body,ie,'left')) < car.pos:distance(epos(rd.body,ie,'left')) and 'left' or 'right'                 lo('?? at_EDGE:'..tostring(ie))
                lo('?? at_EDGE:'..tostring(ie)..':'..side)
            local side = car.pos:distance(epos(rd.body,ie,'left')) < car.pos:distance(epos(rd.body,ie,'left')) and 'left' or 'right'                 lo('?? at_EDGE:'..tostring(ie))
                lo('?? at_EDGE:'..tostring(ie)..':'..side)
--                if true then return end
            local dir = dirroad:dot(dircar) > 0 and 1 or -1
                lo('?? for_dir:'..tostring(dirroad)..':'..tostring(dircar)..':'..dir)
            -- get lane
            local dir = dirroad:dot(dircar) > 0 and 1 or -1
                lo('?? for_dir:'..tostring(dirroad)..':'..tostring(dircar)..':'..dir)
            -- get lane
    --                    out.avedit = {adec[ijmi[1]].list[ijmi[2]], target}
                        U.dump(ijmi, '?? found:'..tostring(target)..':'..adec[ijmi[1]].id..':'..dir)
                    car.target = {
    local onroad
--        lo('?? forTarget_if_command:'..#incommand..':'..tostring(car.target)) --.exit))
--            lo('?? if_T0:'..tostring(car.target)..':'..tostring(car.target.rd))
--        lo('?? forTarget_if_command:'..#incommand..':'..tostring(car.target)) --.exit))
--            lo('?? if_T0:'..tostring(car.target)..':'..tostring(car.target.rd))
--    if car.target and not car.target.exit then
--        lo('?? forTarget_if_command:'..#incommand..':'..tostring(car.target)) --.exit))
--            lo('?? if_T0:'..tostring(car.target)..':'..tostring(car.target.rd))
--    if car.target and not car.target.exit then
        if car.target.ie == ito then
                lo('??___________ END_OF:'..rd.ind..' at:'..ito..':'..car.target.side..' b2b:'..tostring(rd.ij)..' b2l:'..tostring(rd.link)..' e2b:'..tostring(rd.j))
--                lo('?? to_search:')
        if car.target.ie == ito then
                lo('??___________ END_OF:'..rd.ind..' at:'..ito..':'..car.target.side..' b2b:'..tostring(rd.ij)..' b2l:'..tostring(rd.link)..' e2b:'..tostring(rd.j))
--                lo('?? to_search:')
        if car.target.ie == ito then
                lo('??___________ END_OF:'..rd.ind..' at:'..ito..':'..car.target.side..' b2b:'..tostring(rd.ij)..' b2l:'..tostring(rd.link)..' e2b:'..tostring(rd.j))
--                lo('?? to_search:')
--                    out.agreen = {car.target.rd.list[#car.target.rd.list]}
--                    U.dump(rd.frto,'?? E2B:'..tostring(rd.j)..':'..tostring(car.target.rd)..' e:'..tostring(car.target.ie))
--                    if true then return end
--                    out.agreen = {car.target.rd.list[#car.target.rd.list]}
--                    U.dump(rd.frto,'?? E2B:'..tostring(rd.j)..':'..tostring(car.target.rd)..' e:'..tostring(car.target.ie))
--                    if true then return end
--                    out.agreen = {car.target.rd.list[#car.target.rd.list]}
--                    U.dump(rd.frto,'?? E2B:'..tostring(rd.j)..':'..tostring(car.target.rd)..' e:'..tostring(car.target.ie))
--                    if true then return end
--                    out.avedit = {lb,le}
--                    lo('?? lble:'..tostring(lb)..':'..tostring(le))
                local nodei = 2
--                    out.avedit = {lb,le}
--                    lo('?? lble:'..tostring(lb)..':'..tostring(le))
                local nodei = 2
                local ie = edge4node(rd.link, nodei) + (rev and 3 or - 3)
--                    lo('?? nodei:'..tostring(nodei)..':'..ie)
                car.target.p = onLane(ie, rd.link, car.target.side, 1)
--                    lo('?? for_link:'..tostring(rd.link.ind)..':'..nodei..':'..ie)
--                    out.acyan = {car.target.p}
                if false then
                        lo('?? to_GEN:'..tostring(car.vel))
    --                local ang = U.rand(-math.pi/6, math.pi/6)
            end
--                lo('?? newtag:'..tostring(pt)..':'..pi..':'..car.target.side)
--                    out.avedit = borderL
                car.target.curv = curvma
--                    lo('?? CC:'..pi..':'..tostring(curvma)) --..'/'..car.vel:length()..':'..pi..'/'..ito)
                if pi == ito then
                        local r = U.rand(250, 350)
                            lo('?? to_GEN:'..tostring(car.vel)..':'..r..':'..#amatch)
                        local jdesc = junctionUp(car.target.p + r*U.vturn(car.vel:normalized(), U.rand(-math.pi/6, math.pi/6)), math.random(3,5)) --*vec3(math.cos(ang),math.sin(ang)), math.random(3,5))
]]
--                    lo('<< forTraget:'..tostring(car.target.p)..':'..car.target.rd.ind)
                target = car.target
    end
        lo('<< forTarget:'..tostring(target and target.rd and target.rd.ind..':'..target.side or nil)..':'..tostring(target and target.p or nil))
    if true then return target end
    end
        lo('<< forTarget:'..tostring(target and target.rd and target.rd.ind..':'..target.side or nil)..':'..tostring(target and target.p or nil))
    if true then return target end
            end
    --                lo('?? for_rd:'..i..':'..tostring(dmi))
            ::continue::
        if ijmi then
                U.dump(ijmi, '?? cand_found:'..tostring(dmi)..':'..adec[ijmi[1]].id..':'..tostring(car.pos))
                local icheck = 43
        if ijmi then
                U.dump(ijmi, '?? cand_found:'..tostring(dmi)..':'..adec[ijmi[1]].id..':'..tostring(car.pos))
                local icheck = 43
                if false and ijmi[1] ~= icheck then
                        lo('?? wrongWay:'..tostring(car.pos))
                    for i,p in pairs(adec[ijmi[1] ].list) do
                    for i,p in pairs(adec[icheck].list) do
                        lo('?? dist_check:'..icheck..':'..car.pos:distance(p)..':'..tostring(car.pos)..':'..tostring(p))
                    end
                    for i,p in pairs(adec[icheck].list) do
                        lo('?? dist_check:'..icheck..':'..car.pos:distance(p)..':'..tostring(car.pos)..':'..tostring(p))
                    end
    --                    out.avedit = {adec[ijmi[1]].list[ijmi[2]], target}
                        U.dump(ijmi, '?? found:'..tostring(target)..':'..adec[ijmi[1]].id..':'..dir)
                    return {
                        if false then
                            lo('?? if_injunc:'..rd.ind..':'..ajunc[rd.ij[1] ].list[rd.ij[2] ].ind..':'..tostring(rd.dir))
                            -- in junction, next branch
--            local target =
            lo('?? for_LANES:'..tostring(obj.lanesLeft)..':'..obj:getNodeWidth(ijmi[2]-1)..':'..tostring(ndi))
            out.avedit = {adec[ijmi[1] ].list[ijmi[2] ], car.target}
--            local target =
            lo('?? for_LANES:'..tostring(obj.lanesLeft)..':'..obj:getNodeWidth(ijmi[2]-1)..':'..tostring(ndi))
            out.avedit = {adec[ijmi[1] ].list[ijmi[2] ], car.target}
    if not e2d then
        lo('!! ERR_decalSplit_NOE2D:'..tostring(rd))
        return
    ps = U.proj2D(ps)
--        U.dump(e2d, '?? for_e2:'..ifr..':'..tostring(ps)..':'..tostring(epos(rd.body,ifr)))
    local dsplit = e2d[ifr] + ps:distance(epos(rd.body,ifr))
    ps = U.proj2D(ps)
--        U.dump(e2d, '?? for_e2:'..ifr..':'..tostring(ps)..':'..tostring(epos(rd.body,ifr)))
    local dsplit = e2d[ifr] + ps:distance(epos(rd.body,ifr))
        local step = dspl/nstep
--            lo('?? decalSplit:'..rd.ind..':'..dfr..':'..dto..':'..tostring(ifr)..' dspl:'..dspl..':'..nstep..'/'..step..' L:'..rd.L..':'..e2d[#e2d])
        local list = {}

--        lo('?? forCirc:'..tostring(c)..' r:'..r..':'..ir..':'..istep) --..':'..tostring(grid2p({ic,jc})))
--        toMark({grid2p({ic,jc})}, 'cyan', nil, 0.1, 0.6)

--        lo('?? forCirc:'..tostring(c)..' r:'..r..':'..ir..':'..istep) --..':'..tostring(grid2p({ic,jc})))
--        toMark({grid2p({ic,jc})}, 'cyan', nil, 0.1, 0.6)
        for j = jc-ir,jc+ir,istep do
--                fout:write(tostring('fC:'..i..':'..j..':'..ir..'\n'))
            local p = grid2p({i,j})
            local p = grid2p({i,j})
--                if dbg then lo('?? forCirc:'..i..':'..j..':'..tostring(p)..'/'..tostring(c)) end
            if p:distance(c) < r then
            local p = grid2p({i,j})
--                if dbg then lo('?? forCirc:'..i..':'..j..':'..tostring(p)..'/'..tostring(c)) end
            if p:distance(c) < r then
    end
--        U.dump(ap, '?? for_AP:'..#ap..':'..tostring(ap[3]))
        if dbg then toMark(ap, 'white', nil, 0.08, 0.8) end
local function decalPlot(pth, w, ard, ext, dbg)
        lo('>> decalPlot:'..#pth..' w:'..tostring(w)..':'..tostring(ext))
        ap = {}
local function decalPlot(pth, w, ard, ext, dbg)
        lo('>> decalPlot:'..#pth..' w:'..tostring(w)..':'..tostring(ext))
        ap = {}
        for i,d in pairs(list) do
--                fout:write(tostring(n..':'..i..'\n'))
--                lo('??_________ inE_LIST:'..i..'/'..#list..':'..tostring(d.done))
--                fout:write(tostring(n..':'..i..'\n'))
--                lo('??_________ inE_LIST:'..i..'/'..#list..':'..tostring(d.done))
            if not d.done then
                local dist = a:distance(b)
--                    fout:write(tostring('o2:'..n..':'..i..':'..(dist/6)..':'..grid..':'..tostring(a)..':'..tostring(b)..'\n'))
                forCirc((a+b)/2, dist*1/2*cseek, dist/6, function(p)
                local dist = a:distance(b)
--                    fout:write(tostring('o2:'..n..':'..i..':'..(dist/6)..':'..grid..':'..tostring(a)..':'..tostring(b)..'\n'))
                forCirc((a+b)/2, dist*1/2*cseek, dist/6, function(p)
                local dist = a:distance(b)
--                    fout:write(tostring('o2:'..n..':'..i..':'..(dist/6)..':'..grid..':'..tostring(a)..':'..tostring(b)..'\n'))
                forCirc((a+b)/2, dist*1/2*cseek, dist/6, function(p)
                forCirc((a+b)/2, dist*1/2*cseek, dist/6, function(p)
            --            lo('?? if_CURVE:'..tostring(p)..':'..tostring(forZ(p))..':'..p:distance(pfr)..':'..pto:distance(p))
--                        fout:write(tostring('oc:'..n..':'..i..':'..tostring(p)..'\n'))
                forCirc((a+b)/2, dist*1/2*cseek, dist/6, function(p)
            --            lo('?? if_CURVE:'..tostring(p)..':'..tostring(forZ(p))..':'..p:distance(pfr)..':'..pto:distance(p))
--                        fout:write(tostring('oc:'..n..':'..i..':'..tostring(p)..'\n'))
            --            lo('?? if_CURVE:'..tostring(p)..':'..tostring(forZ(p))..':'..p:distance(pfr)..':'..pto:distance(p))
--                        fout:write(tostring('oc:'..n..':'..i..':'..tostring(p)..'\n'))
                    local crv = geomEval(ac, {a, p, b}, 2)
            --            lo('?? if_CURVE:'..tostring(p)..':'..tostring(forZ(p))..':'..p:distance(pfr)..':'..pto:distance(p))
--                        fout:write(tostring('oc:'..n..':'..i..':'..tostring(p)..'\n'))
                    local crv = geomEval(ac, {a, p, b}, 2)
                end) --, i == 2 and #list == 2) --, true)--, n==4)
--                    fout:write(tostring('o3:'..n..':'..i..'\n'))

--                    lo('?? if_pmi:'..tostring(pmi))
--                        if i == 2 and #list == 2 then
--                        if i == 2 and #list == 2 then
--                            lo('?? if_PMI:'..tostring(pmi))
--                        end
        end
--            U.dump(list, '?? LIST:'..tostring(done)..':'..n)
            if dbg then lo('?? next_L: L:'..#list..' n:'..n..':'..tostring(done)) end
--            U.dump(list, '?? LIST:'..tostring(done)..':'..n)
            if dbg then lo('?? next_L: L:'..#list..' n:'..n..':'..tostring(done)) end
--            if true then break end
        for i=2,#list-1 do
--                lo('?? for_i:'..i..':'..tostring(list[i-1]))
--                U.dump(list[i-1], '?? l-1:'..i)
        if i > 1 then
--                lo('?? for_seg:'..i..':'..tostring(d.ps)..':'..tostring(d.e[1]))
                if i and d.ps then
        if i > 1 then
--                lo('?? for_seg:'..i..':'..tostring(d.ps)..':'..tostring(d.e[1]))
                if i and d.ps then
        toMark(ap, 'red', nil, 0.1, 0.6)
        lo('<< decalPlot: n:'..n..':'..#list..':'..#ap2..':'..tostring(out.inplot))
--        out.aplot = {{e=ap2}}
--        for d = 0,step*nstep,step do
--                lo('?? to_LIST:'..d..'/'..rd.L..':'..(step*nstep)) --..':'..tostring(onSide(rd,'middle',870))..':'..tostring(onSide(rd,'middle',902)))
            list[#list+1] = onSide(rd,'middle',d)
--        for d = 0,step*nstep,step do
--                lo('?? to_LIST:'..d..'/'..rd.L..':'..(step*nstep)) --..':'..tostring(onSide(rd,'middle',870))..':'..tostring(onSide(rd,'middle',902)))
            list[#list+1] = onSide(rd,'middle',d)
--                            if U.vang(pmi-a,b-pmi)>(math.pi*1/2)  then
--                                lo('??_______ SHARP:'..#list..':'..tostring(pmi)..':'..(U.vang(pmi-a,b-pmi)-0)..'>'..tostring(math.pi/2)..':'..tostring(U.vang(pmi-a,b-pmi)<(math.pi*5/6)))
--                            end
--                            if U.vang(pmi-a,b-pmi)>(math.pi*1/2)  then
--                                lo('??_______ SHARP:'..#list..':'..tostring(pmi)..':'..(U.vang(pmi-a,b-pmi)-0)..'>'..tostring(math.pi/2)..':'..tostring(U.vang(pmi-a,b-pmi)<(math.pi*5/6)))
--                            end
--                            if U.vang(pmi-a,b-pmi)>(math.pi*1/2)  then
--                                lo('??_______ SHARP:'..#list..':'..tostring(pmi)..':'..(U.vang(pmi-a,b-pmi)-0)..'>'..tostring(math.pi/2)..':'..tostring(U.vang(pmi-a,b-pmi)<(math.pi*5/6)))
--                            end
--                                lo('?? for_curv:'..U.vang(pmi-a,b-pmi))
--                            lo('?? for_DC:'..dc..':'..n..':'..tostring(u))
--                        dc = cmi - U.
    if dir == -1 and car.gaz == -1 then return end
        lo('>> D.keyUD:'..dir..':'..#adec..':'..tostring(car.pos))
    if dir == 1 then
        local target = car.target or forTarget()
--            U.dump(out.avedit,'?? if_target:'..tostring(target))
        if target then
    end
        lo('<< D.keyUD:'..tostring(car.target))
end
    end
        lo('?? apply:'..tostring(aconf and #aconf or nil)..':'..tostring(out.inconform)..':'..tostring(out.inall)..':'..tostring(cdesc))
    end
        lo('?? apply:'..tostring(aconf and #aconf or nil)..':'..tostring(out.inconform)..':'..tostring(out.inall)..':'..tostring(cdesc))
    end
        lo('?? apply:'..tostring(aconf and #aconf or nil)..':'..tostring(out.inconform)..':'..tostring(out.inall)..':'..tostring(cdesc))
    end
        lo('?? apply:'..tostring(aconf and #aconf or nil)..':'..tostring(out.inconform)..':'..tostring(out.inall)..':'..tostring(cdesc))
                local rd = adec[cdesc]
                    lo('?? undo_local:'..#adec[cdesc].aset..':'..tableSize(mask)..':'..tostring(rd.jrad))
                    local amark = {}
                for _,ijs in pairs(rd.aset) do
--                        lo('?? for_ijs:'..tostring(ijs))
                    local d = mask[ijs]
    if false and cdesc then
            lo('?? set_one:'..tostring(cdesc))
        road2ter({cdesc})
    end
        lo('<< apply:'..key..':'..val..':'..tostring(cdesc)..':'..tostring(cpick))
end
    end
        lo('<< apply:'..key..':'..val..':'..tostring(cdesc)..':'..tostring(cpick))
end
    local rayCast,rayCastHit = cameraMouseRayCast(false)
--            lo('?? D.upd:'..tostring(rayCast))
--    if not rayCast then return end
    if rayCast then
--        lo('?? D.onUpdate:'..tostring(rayCast.object.name))
        if rayCast.object.name ~= 'theTerrain' then return end
    if editor.keyModifiers.alt then
--            lo('?? to_plot:'..tostring(cjunc)..':'..tostring(out.aplot))
        if not U._MODE=='conf' and not out.aplot then
    if editor.keyModifiers.alt then
--            lo('?? to_plot:'..tostring(cjunc)..':'..tostring(out.aplot))
        if not U._MODE=='conf' and not out.aplot then
                            if roadID ~= cpick and not indrag then -- and not cjunc then
            --                    lo('?? SWITCH_select:'..tostring(cmover)..'>'..roadID)
                                cmover = roadID
                if editor.keyModifiers.shift then
--                    lo('?? over_RD:'..tostring(rdhit)..':'..tostring(adec[rdhit].id))
                end
                if editor.keyModifiers.shift then
--                    lo('?? over_RD:'..tostring(rdhit)..':'..tostring(adec[rdhit].id))
                end

    --            lo('?? if_is:'..tostring(ishit))
        if not ishit then -- and not cpick then
--            if _dbdrag then return end
--            lo('?? ifDRAG:'..tostring(out.pdrag))
                indrag = rayCast.pos
                    lo('?? to_DRAG:'..tostring(indrag)..':'..out.pdrag.ind)
                out.avedit = {}
            if (rayCast.pos-indrag):length() > 1. then
--                    lo('?? dragging:'..out.pdrag.ind..':'..tostring(rayCast.pos-out.indrag))
                -- update road angle
        end
            lo('?? D.mup:'..tostring(cjunc)..':'..tostring(incontrol)..':'..tostring(cmover)..' ind:'..tostring(cdescmo)..':'..tostring(indrag)) --..':'..tostring(rayCast and rayCast.pos or nil)..':'..tostring(cdescmo and adec[cdescmo].body:getOrCreatePersistentID() or nil))
        for key,val in pairs(dval) do
        end
            lo('?? D.mup:'..tostring(cjunc)..':'..tostring(incontrol)..':'..tostring(cmover)..' ind:'..tostring(cdescmo)..':'..tostring(indrag)) --..':'..tostring(rayCast and rayCast.pos or nil)..':'..tostring(cdescmo and adec[cdescmo].body:getOrCreatePersistentID() or nil))
        for key,val in pairs(dval) do
        end
            lo('?? D.mup:'..tostring(cjunc)..':'..tostring(incontrol)..':'..tostring(cmover)..' ind:'..tostring(cdescmo)..':'..tostring(indrag)) --..':'..tostring(rayCast and rayCast.pos or nil)..':'..tostring(cdescmo and adec[cdescmo].body:getOrCreatePersistentID() or nil))
        for key,val in pairs(dval) do
        end
            lo('?? D.mup:'..tostring(cjunc)..':'..tostring(incontrol)..':'..tostring(cmover)..' ind:'..tostring(cdescmo)..':'..tostring(indrag)) --..':'..tostring(rayCast and rayCast.pos or nil)..':'..tostring(cdescmo and adec[cdescmo].body:getOrCreatePersistentID() or nil))
        for key,val in pairs(dval) do
        end
            lo('?? D.mup:'..tostring(cjunc)..':'..tostring(incontrol)..':'..tostring(cmover)..' ind:'..tostring(cdescmo)..':'..tostring(indrag)) --..':'..tostring(rayCast and rayCast.pos or nil)..':'..tostring(cdescmo and adec[cdescmo].body:getOrCreatePersistentID() or nil))
        for key,val in pairs(dval) do
        end
            lo('?? D.mup:'..tostring(cjunc)..':'..tostring(incontrol)..':'..tostring(cmover)..' ind:'..tostring(cdescmo)..':'..tostring(indrag)) --..':'..tostring(rayCast and rayCast.pos or nil)..':'..tostring(cdescmo and adec[cdescmo].body:getOrCreatePersistentID() or nil))
        for key,val in pairs(dval) do
        end
            lo('?? D.mup:'..tostring(cjunc)..':'..tostring(incontrol)..':'..tostring(cmover)..' ind:'..tostring(cdescmo)..':'..tostring(indrag)) --..':'..tostring(rayCast and rayCast.pos or nil)..':'..tostring(cdescmo and adec[cdescmo].body:getOrCreatePersistentID() or nil))
        for key,val in pairs(dval) do
                    else
                            lo('?? src:'..tostring(ps))
                        out.sidepick = {
                    end
    --                        lo('?? if_SIDE:'..tostring(cmover)..':'..tostring(cdescmo)..':'..dl..':'..dr)
    --                        toMark({ps},'blue')
                    end
    --                        lo('?? if_SIDE:'..tostring(cmover)..':'..tostring(cdescmo)..':'..dl..':'..dr)
    --                        toMark({ps},'blue')
            if rayCast then
                    lo('?? check_HIT:'..tostring(rayCast.pos)..':'..#adec)
                local p = U.proj2D(rayCast.pos)
                                if j == #adec then
    --                                lo('?? for_DIST:'..j..':'..k..':'..p:distance(n)..':'..tostring(n))
                                end
                end
--                    lo('?? for_DIR:'..jmi..':'..ie1..':'..ie2..':'..tostring(D.epos(adec[jmi].body, ie1)-p)..':'..tostring((D.epos(adec[jmi].body,ie2)-p))..':'..tostring(p))-- :dot(D.epos(adec[jmi].body,ie2)-p))
                    lo('?? if_HIT:'..tostring(dmi)..':'..tostring(jmi)) --..':'..nmi..':'..adec[jmi].ind) --..' ie:'..ie1..':'..tostring(adec[jmi].ne))
                end
--                    lo('?? for_DIR:'..jmi..':'..ie1..':'..ie2..':'..tostring(D.epos(adec[jmi].body, ie1)-p)..':'..tostring((D.epos(adec[jmi].body,ie2)-p))..':'..tostring(p))-- :dot(D.epos(adec[jmi].body,ie2)-p))
                    lo('?? if_HIT:'..tostring(dmi)..':'..tostring(jmi)) --..':'..nmi..':'..adec[jmi].ind) --..' ie:'..ie1..':'..tostring(adec[jmi].ne))
                end
--                    lo('?? for_DIR:'..jmi..':'..ie1..':'..ie2..':'..tostring(D.epos(adec[jmi].body, ie1)-p)..':'..tostring((D.epos(adec[jmi].body,ie2)-p))..':'..tostring(p))-- :dot(D.epos(adec[jmi].body,ie2)-p))
                    lo('?? if_HIT:'..tostring(dmi)..':'..tostring(jmi)) --..':'..nmi..':'..adec[jmi].ind) --..' ie:'..ie1..':'..tostring(adec[jmi].ne))
--                    lo('?? for_DIR:'..jmi..':'..ie1..':'..ie2..':'..tostring(D.epos(adec[jmi].body, ie1)-p)..':'..tostring((D.epos(adec[jmi].body,ie2)-p))..':'..tostring(p))-- :dot(D.epos(adec[jmi].body,ie2)-p))
                    lo('?? if_HIT:'..tostring(dmi)..':'..tostring(jmi)) --..':'..nmi..':'..adec[jmi].ind) --..' ie:'..ie1..':'..tostring(adec[jmi].ne))
                local ps,ds = rayCast.pos
--                    lo('?? for_DIR:'..jmi..':'..ie1..':'..ie2..':'..tostring(D.epos(adec[jmi].body, ie1)-p)..':'..tostring((D.epos(adec[jmi].body,ie2)-p))..':'..tostring(p))-- :dot(D.epos(adec[jmi].body,ie2)-p))
                    lo('?? if_HIT:'..tostring(dmi)..':'..tostring(jmi)) --..':'..nmi..':'..adec[jmi].ind) --..' ie:'..ie1..':'..tostring(adec[jmi].ne))
                local ps,ds = rayCast.pos
--                    lo('?? for_DIR:'..jmi..':'..ie1..':'..ie2..':'..tostring(D.epos(adec[jmi].body, ie1)-p)..':'..tostring((D.epos(adec[jmi].body,ie2)-p))..':'..tostring(p))-- :dot(D.epos(adec[jmi].body,ie2)-p))
                    lo('?? if_HIT:'..tostring(dmi)..':'..tostring(jmi)) --..':'..nmi..':'..adec[jmi].ind) --..' ie:'..ie1..':'..tostring(adec[jmi].ne))
                local ps,ds = rayCast.pos
                        ps = adec[jmi].list[nmi]
                            lo('??++++++++++++++++ end_node:'..dmi..':'..nmi..':'..tostring(ps))
                        out.acyan = {ps}
                        ds,ps = toSide(p,adec[jmi],'middle')
                            lo('?? inside:'..tostring(ps)..':'..ds..'/'..(adec[jmi].aw[nmi])..':'..jmi)
--                            D.toMark({ps},'cyan')
                                    local step = dlen/nstep
        --                                lo('?? decalSplit:'..rd.ind..':'..dfr..':'..dto..':'..tostring(ifr)..' dspl:'..dspl..':'..nstep..'/'..step)
                                    local u = (pto-pfr):normalized()
                    if out.sidepick then
--                            lo('?? if_SP:'..tostring(out.sidepick)..':'..tostring(out.sidepick.list and #out.sidepick.list or 0))
                        out.sidepick.list[#out.sidepick.list+1] = rayCast.pos
                    if out.sidepick then
--                            lo('?? if_SP:'..tostring(out.sidepick)..':'..tostring(out.sidepick.list and #out.sidepick.list or 0))
                        out.sidepick.list[#out.sidepick.list+1] = rayCast.pos
                    out.sidepick = {list={rayCast.pos}}
                        lo('?? sPICK:'..tostring(rayCast.pos)..':'..#out.sidepick.list)
                    return 1
                    end
--                            lo('?? if_SP:'..tostring(out.sidepick)..':'..tostring(out.sidepick.list and #out.sidepick.list or 0))
                    out.sidepick.list[#out.sidepick.list+1] = ps
                    end
--                            lo('?? if_SP:'..tostring(out.sidepick)..':'..tostring(out.sidepick.list and #out.sidepick.list or 0))
                    out.sidepick.list[#out.sidepick.list+1] = ps
                        out.sidepick = nil
                            lo('?? pre_LOAD:') --..tostring(out.inj))
                        decalsLoad() --nil,nil,id)
                out.sidepick = {list={ps},split={ds and jmi or false},src= jmi and adec[jmi].id or nil}
                    lo('?? sPICK:'..tostring(rayCast.pos)..':'..#out.sidepick.list)
                return 1
                    else
                            lo('?? src:'..tostring(ps))
                        out.sidepick = {
                    end
    --                        lo('?? if_SIDE:'..tostring(cmover)..':'..tostring(cdescmo)..':'..dl..':'..dr)
    --                        toMark({ps},'blue')
                    end
    --                        lo('?? if_SIDE:'..tostring(cmover)..':'..tostring(cdescmo)..':'..dl..':'..dr)
    --                        toMark({ps},'blue')
            out.sidepick = nil
--                lo('?? nnc:'..tostring(incontrol))
            -- detect junction hit
                if rayCast and rayCast.pos:distance(d.p) < 3 then
                        lo('??^^^^^^^^ junc_hit:'..tostring(i)..':'..tostring(cjunc)..'/'..#ajunc)
                    if cjunc == i then
                if rayCast and rayCast.pos:distance(d.p) < 3 then
                        lo('??^^^^^^^^ junc_hit:'..tostring(i)..':'..tostring(cjunc)..'/'..#ajunc)
                    if cjunc == i then
                    end
--                        lo('?? junc_hit2:'..tostring(cjunc)..':'..tostring(ajunc[cjunc].r))
                    return 1
                    end
--                        lo('?? junc_hit2:'..tostring(cjunc)..':'..tostring(ajunc[cjunc].r))
                    return 1
                    for _,ind in pairs(apick) do
--                                lo('?? ind:'..tostring(ind))
                        local rd = adec[ind]
                        U.dump(out.ared, '?? ared:')
                        lo('??**************** D.onUp_DONE:'..tostring(cdescmo)..':'..#apick)
                    if cdescmo then return cdescmo or 0 end
                        local ind = inAdec(cpick)
                        U.dump(across[ind], '?? picked:'..tostring(ind)..':'..tostring(cpick)..':'..tostring(croad)..':'..tostring(croad and croad:getOrCreatePersistentID() or nil))
--                croad:setField("material", 0, "road1_concrete")
                        local ind = inAdec(cpick)
                        U.dump(across[ind], '?? picked:'..tostring(ind)..':'..tostring(cpick)..':'..tostring(croad)..':'..tostring(croad and croad:getOrCreatePersistentID() or nil))
--                croad:setField("material", 0, "road1_concrete")
                        local ind = inAdec(cpick)
                        U.dump(across[ind], '?? picked:'..tostring(ind)..':'..tostring(cpick)..':'..tostring(croad)..':'..tostring(croad and croad:getOrCreatePersistentID() or nil))
--                croad:setField("material", 0, "road1_concrete")
                        local ind = inAdec(cpick)
                        U.dump(across[ind], '?? picked:'..tostring(ind)..':'..tostring(cpick)..':'..tostring(croad)..':'..tostring(croad and croad:getOrCreatePersistentID() or nil))
--                croad:setField("material", 0, "road1_concrete")
        if not car.time or ctime - car.time > 0.1 then --0.02 then
--                lo('?? for_time:'..ctime..':'..tostring(car.time))
--                lo('?? for_DV:'..tostring(veh:getDirectionVector())..':'..tostring(veh:getVelocity():normalized()))
--                lo('?? for_time:'..ctime..':'..tostring(car.time))
--                lo('?? for_DV:'..tostring(veh:getDirectionVector())..':'..tostring(veh:getVelocity():normalized()))
            if veh:getVelocity():length() > 8 then
--                lo('?? for_time:'..ctime..':'..tostring(car.time))
--                lo('?? for_DV:'..tostring(veh:getDirectionVector())..':'..tostring(veh:getVelocity():normalized()))
            if veh:getVelocity():length() > 8 then
            if car.gaz < 0 then
--                    lo('?? for_back_vel:'..tostring(veh:getVelocity()))
                if veh:getVelocity():length() < 0.1 then
                if veh:getVelocity():length() < 0.1 then
                        lo('?? for_back_STOP:'..tostring(veh:getVelocity()))
                    car.gaz = 0
                if car.target.exit then -- and car.pos:distance(car.target.exit.p) < car.vel*3.  then
--                        lo('?? for_EXIT:'..tostring(car.target.exit.p))
                    if car.target.exit.p then
                            car.target.exit = nil
                                lo('??_____________________ to_EXIT:'..car.target.rd.ind..':'..tostring(car.target.rd.ij)..' lane:'..car.target.lane)
                                out.avedit = {car.target.p}
                    if ccommand ~= incommand[1] then
                        lo('?? for_COMMAND:'..incommand[1]..':'..tostring(inexit)..':'..tostring(car.target.lane))
                    end
                    if ccommand ~= incommand[1] then
                        lo('?? for_COMMAND:'..incommand[1]..':'..tostring(inexit)..':'..tostring(car.target.lane))
                    end
                    end
--                        U.dump(car.target, '?? for_COMMAND:'..incommand[1]..':'..tostring(inexit))
                    ccommand = incommand[1]
                        elseif incommand[1] == 'left' and car.target.rd then
--                            U.dump(adec[car.target.rd.ind].lane, '?? if_LANE:'..tostring(car.target.lane)..':'..tostring(car.target.side))
                            local nlane = car.target.side=='right' and adec[car.target.rd.ind].lane[2] or adec[car.target.rd.ind].lane[1]
                        elseif incommand[1] == 'left' and car.target.rd then
--                            U.dump(adec[car.target.rd.ind].lane, '?? if_LANE:'..tostring(car.target.lane)..':'..tostring(car.target.side))
                            local nlane = car.target.side=='right' and adec[car.target.rd.ind].lane[2] or adec[car.target.rd.ind].lane[1]
--                elseif not inexit and not car.target.exit and car.target.p:distance(car.pos) < default.v2tmin and car.gaz>0 then
                        lo('?? pre_target:'..tostring(car.target.rd)) --.ind)
                    local target = forTarget()
                    local target = forTarget()
--                        lo('?? next_target:'..tostring(target))
                    if not target then
                    else
--                            lo('?? change_target:'..tostring(car.target.p)..'>'..tostring(target.p))
                        car.target = target
                    else
--                            lo('?? change_target:'..tostring(car.target.p)..'>'..tostring(target.p))
                        car.target = target
                    if U.vang(car.vel, car.target.p-car.pos) < 0.3 then
    --                    lo('??_____________________ for_ang:'..tostring(U.vang(car.vel, car.target-car.pos)))
    --                    toTarget()
    if im.IsMouseClicked(0) and inView() and rayCast then
            lo('?? D.click:'..tostring(rayCast.pos)..':'..tostring(out.pdrag)..':'..tostring(cmover)..':'..tostring(cmover and scenetree.findObjectById(cmover):getOrCreatePersistentID() or nil))
        if editor.keyModifiers.shift then
    if im.IsMouseClicked(0) and inView() and rayCast then
            lo('?? D.click:'..tostring(rayCast.pos)..':'..tostring(out.pdrag)..':'..tostring(cmover)..':'..tostring(cmover and scenetree.findObjectById(cmover):getOrCreatePersistentID() or nil))
        if editor.keyModifiers.shift then
    if im.IsMouseClicked(0) and inView() and rayCast then
            lo('?? D.click:'..tostring(rayCast.pos)..':'..tostring(out.pdrag)..':'..tostring(cmover)..':'..tostring(cmover and scenetree.findObjectById(cmover):getOrCreatePersistentID() or nil))
        if editor.keyModifiers.shift then
    if im.IsMouseClicked(0) and inView() and rayCast then
            lo('?? D.click:'..tostring(rayCast.pos)..':'..tostring(out.pdrag)..':'..tostring(cmover)..':'..tostring(cmover and scenetree.findObjectById(cmover):getOrCreatePersistentID() or nil))
        if editor.keyModifiers.shift then
                    end
--                        lo('?? if_SIDE:'..tostring(cmover)..':'..tostring(cdescmo)..':'..dl..':'..dr)
--                        toMark({ps},'blue')
                    end
--                        lo('?? if_SIDE:'..tostring(cmover)..':'..tostring(cdescmo)..':'..dl..':'..dr)
--                        toMark({ps},'blue')
        elseif out.pdrag and not U._MODE == 'conf' then
                lo('?? for_cj:'..tostring(out.pdrag.jind)..':'..tostring(indrag))
            cjunc = out.pdrag.jind
        elseif out.pdrag and not U._MODE == 'conf' then
                lo('?? for_cj:'..tostring(out.pdrag.jind)..':'..tostring(indrag))
            cjunc = out.pdrag.jind
    --        guihooks.trigger("AIStateChange") --, getState())
                lo('?? to_input:'..tostring(cpos)..':'..tostring(veh:getVelocity()))
        elseif false then
    --        guihooks.trigger("AIStateChange") --, getState())
                lo('?? to_input:'..tostring(cpos)..':'..tostring(veh:getVelocity()))
        elseif false then
                if rayCast.pos:distance(d.p) < 3 then
                        lo('?? junc_hit:'..tostring(i)..':'..tostring(cjunc))
                    if cjunc == i then
                if rayCast.pos:distance(d.p) < 3 then
                        lo('?? junc_hit:'..tostring(i)..':'..tostring(cjunc))
                    if cjunc == i then
        if not rayCast or rayCast.object.name ~= 'theTerrain' then return end
            lo('?? decal_CLICK:'..':'..tostring(rayCast.object.name)..':'..tostring(cmover)..':'..tostring(cpick)..'/'..tostring(croad)..':'..tostring(rayCastHit)..':'..tostring(im.IsWindowHovered(im.HoveredFlags_AnyWindow))..':'..tostring(im.IsAnyItemHovered()))
        if cmover and not cjunc then
        if not rayCast or rayCast.object.name ~= 'theTerrain' then return end
            lo('?? decal_CLICK:'..':'..tostring(rayCast.object.name)..':'..tostring(cmover)..':'..tostring(cpick)..'/'..tostring(croad)..':'..tostring(rayCastHit)..':'..tostring(im.IsWindowHovered(im.HoveredFlags_AnyWindow))..':'..tostring(im.IsAnyItemHovered()))
        if cmover and not cjunc then
        if not rayCast or rayCast.object.name ~= 'theTerrain' then return end
            lo('?? decal_CLICK:'..':'..tostring(rayCast.object.name)..':'..tostring(cmover)..':'..tostring(cpick)..'/'..tostring(croad)..':'..tostring(rayCastHit)..':'..tostring(im.IsWindowHovered(im.HoveredFlags_AnyWindow))..':'..tostring(im.IsAnyItemHovered()))
        if cmover and not cjunc then
        if not rayCast or rayCast.object.name ~= 'theTerrain' then return end
            lo('?? decal_CLICK:'..':'..tostring(rayCast.object.name)..':'..tostring(cmover)..':'..tostring(cpick)..'/'..tostring(croad)..':'..tostring(rayCastHit)..':'..tostring(im.IsWindowHovered(im.HoveredFlags_AnyWindow))..':'..tostring(im.IsAnyItemHovered()))
        if cmover and not cjunc then
        if not rayCast or rayCast.object.name ~= 'theTerrain' then return end
            lo('?? decal_CLICK:'..':'..tostring(rayCast.object.name)..':'..tostring(cmover)..':'..tostring(cpick)..'/'..tostring(croad)..':'..tostring(rayCastHit)..':'..tostring(im.IsWindowHovered(im.HoveredFlags_AnyWindow))..':'..tostring(im.IsAnyItemHovered()))
        if cmover and not cjunc then
        if not rayCast or rayCast.object.name ~= 'theTerrain' then return end
            lo('?? decal_CLICK:'..':'..tostring(rayCast.object.name)..':'..tostring(cmover)..':'..tostring(cpick)..'/'..tostring(croad)..':'..tostring(rayCastHit)..':'..tostring(im.IsWindowHovered(im.HoveredFlags_AnyWindow))..':'..tostring(im.IsAnyItemHovered()))
        if cmover and not cjunc then
        if not rayCast or rayCast.object.name ~= 'theTerrain' then return end
            lo('?? decal_CLICK:'..':'..tostring(rayCast.object.name)..':'..tostring(cmover)..':'..tostring(cpick)..'/'..tostring(croad)..':'..tostring(rayCastHit)..':'..tostring(im.IsWindowHovered(im.HoveredFlags_AnyWindow))..':'..tostring(im.IsAnyItemHovered()))
        if cmover and not cjunc then
                    if rayCastHit and (rayCastHit - n.pos):length() < 1 then
                            lo('?? for_e:'..tostring(n.edges))
                        nodehit = i
                    end
--                    lo('?? if_hit:'..i..':'..tostring((rayCastHit - n.pos):length()))
                end
            end
                lo('?? if_rc:'..tostring(nodehit)..':'..tostring(cmover)..':'..tostring(rayCastHit))
            if false and nodehit == nil and rayCastHit then
            end
                lo('?? if_rc:'..tostring(nodehit)..':'..tostring(cmover)..':'..tostring(rayCastHit))
            if false and nodehit == nil and rayCastHit then
            end
                lo('?? if_rc:'..tostring(nodehit)..':'..tostring(cmover)..':'..tostring(rayCastHit))
            if false and nodehit == nil and rayCastHit then
                        for _,ind in pairs(apick) do
--                                lo('?? ind:'..tostring(ind))
                            local rd = adec[ind]
                            U.dump(out.ared, '?? ared:')
                            lo('??**************** D.onUp_DONE:'..tostring(cdescmo)..':'..#apick)
                        if cdescmo then return cdescmo or 0 end
                            local ind = inAdec(cpick)
                            U.dump(across[ind], '?? picked:'..tostring(ind)..':'..tostring(cpick)..':'..tostring(croad)..':'..tostring(croad and croad:getOrCreatePersistentID() or nil))
    --                croad:setField("material", 0, "road1_concrete")
                            local ind = inAdec(cpick)
                            U.dump(across[ind], '?? picked:'..tostring(ind)..':'..tostring(cpick)..':'..tostring(croad)..':'..tostring(croad and croad:getOrCreatePersistentID() or nil))
    --                croad:setField("material", 0, "road1_concrete")
                            local ind = inAdec(cpick)
                            U.dump(across[ind], '?? picked:'..tostring(ind)..':'..tostring(cpick)..':'..tostring(croad)..':'..tostring(croad and croad:getOrCreatePersistentID() or nil))
    --                croad:setField("material", 0, "road1_concrete")
                            local ind = inAdec(cpick)
                            U.dump(across[ind], '?? picked:'..tostring(ind)..':'..tostring(cpick)..':'..tostring(croad)..':'..tostring(croad and croad:getOrCreatePersistentID() or nil))
    --                croad:setField("material", 0, "road1_concrete")
--            local rd = scenetree.findObjectById(roadID)
--                lo('?? PI:'..tostring(rd and rd:getOrCreatePersistentID())) -- getField('material')) or) --rd.persistentId))

                lo('??****** seled:'..tableSize(anodesel)..':'..#anodesel..' cdesc:'..tostring(cdesc)..':'..tostring(nodehit)..':'..tostring(cpick)..':'..#apick)
        elseif editor.keyModifiers.ctrl then

                lo('??****** seled:'..tableSize(anodesel)..':'..#anodesel..' cdesc:'..tostring(cdesc)..':'..tostring(nodehit)..':'..tostring(cpick)..':'..#apick)
        elseif editor.keyModifiers.ctrl then

                lo('??****** seled:'..tableSize(anodesel)..':'..#anodesel..' cdesc:'..tostring(cdesc)..':'..tostring(nodehit)..':'..tostring(cpick)..':'..#apick)
        elseif editor.keyModifiers.ctrl then
        rdlist = editor.getAllRoads()
            lo('?? new_list:'..tostring(tableSize(rdlist)))
    end
    if out.avedit ~= nil and #out.avedit>0 then
--            lo('?? onUp_avedit:'..tostring(out.avedit[1]))
--            _dbdrag = true

--        lo('?? rdlist:'..tostring(aiRoadsSelectable)..':'..hasroads)
end
@/lua/ge/extensions/util/nodeBeamExport.lua
  if ok then
    log('I', logTag, 'Exported nodes/beams to ' .. tostring(filename))
  else
  else
    log('E', logTag, 'Failed writing file ' .. tostring(filename))
  end
@/lua/vehicle/ai.lua
    if not name then break end
    print(string.format("Upvalue %d: %s = %s", i, name, tostring(value)))
    i = i + 1
    --obj.debugDrawProxy:drawSphere(1, tSi.pos, sColor)
    --obj.debugDrawProxy:drawText(tSi.pos + vec3(0, 0, 1), color(0,0,0,255), tostring(tSi.turn))
      for i = 1, scrCount - (loopPath and 1 or 0) do -- avoid adding the last point if the scripts loops
        local node = 'wp_'..tostring(i)
        pathMap:setPointPositionRadius(node, vec3(arg.script[i].x, arg.script[i].y, arg.script[i].z), arg.script[i].r or radius)
@/lua/ge/extensions/gameplay/drift/general.lua
      for _, n in ipairs(contextList) do
        s = s .. tostring(n) .. "\0"
      end
        for _, n in ipairs(challengeModeList) do
          s = s .. tostring(n) .. "\0"
        end
          if _G[extensionName] and _G[extensionName].getGC then
            im.Text(tostring(_G[extensionName].getGC()))
          else

    im.Text("Paused : " .. tostring(paused))
    im.Text("Frozen : " .. tostring(frozen))
    im.Text("Paused : " .. tostring(paused))
    im.Text("Frozen : " .. tostring(frozen))
  end
@/lua/ge/extensions/core/environment.lua
  if not filePath or filePath == "" then return nil end
  local gradientFile = tostring(filePath)
  if gradientFile == "" then return nil end
  if scatterSkyObj then
    return tostring(scatterSkyObj.colorizeGradientFile)
  end
  if scatterSkyObj then
    return tostring(scatterSkyObj.sunScaleGradientFile)
  end
  if scatterSkyObj then
    return tostring(scatterSkyObj.ambientScaleGradientFile)
  end
  if scatterSkyObj then
    return tostring(scatterSkyObj.fogScaleGradientFile)
  end
  if scatterSkyObj then
    return tostring(scatterSkyObj.nightGradientFile)
  end
  if scatterSkyObj then
    return tostring(scatterSkyObj.nightFogGradientFile)
  end
    if knownProblems[j] then
      log('E', 'groundmodels', 'Please fix your grounmodel up: ' .. tostring(j) .. ' should be instead: ' .. knownProblems[j])
    elseif not knownAttributes[j] then
    elseif not knownAttributes[j] then
      log('E', 'groundmodels', 'Unknown ground model attribute: ' .. tostring(j) .. ' - IGNORED')
    end
    gm.collisiontype = particles.getOrAddMaterialIDByName(materials, v.collisiontype)
    --print(v.collisiontype .. ' -> ' .. tostring(gm.collisiontype))
  end
    be:setGroundModel(newName, gm)
    --print("****** setting groundmodel: " .. tostring(newName))
    -- save them in lua so we could work with them later
      local newk = string.sub(k, 1, 30)
      log('E', 'ge.environment.reloadGroundModels', 'Ground model name too long: "' .. tostring(k) .. '" is longer than the supported 31 characters. It will be cut to "' .. tostring(newk) .. '")')
      k = newk
      local newk = string.sub(k, 1, 30)
      log('E', 'ge.environment.reloadGroundModels', 'Ground model name too long: "' .. tostring(k) .. '" is longer than the supported 31 characters. It will be cut to "' .. tostring(newk) .. '")')
      k = newk
    if gms['ASPHALT'] == nil then
      log('E', 'ge.environment.reloadGroundModels', 'Ground model "ASPHALT" was not found in: ' .. tostring(gm_filename))
    end
local function onClientPostStartMission(levelPath)
  --print("onClientPreStartMission: " .. tostring(levelPath))
  envObjectIdCache = {}
@/lua/ge/extensions/editor/suspensionAudioDebug.lua
            im.SameLine()
            im.Text(tostring(val.position))
            if val.volume then
              local impulseArr = im.TableToArrayFloat(beamSounds[bi].impulseTbl)--not actually stress, things are named poorly in sounds.lua
              im.PlotLines1("", impulseArr, im.GetLengthArrayFloat(impulseArr), counter, "maxStress: " ..tostring(val.maxStress), 0, val.maxStress, im.ImVec2(400, 80))
              im.Text("Pitch")
              local pitchArr = im.TableToArrayFloat(beamSounds[bi].pitchTbl)
              im.PlotLines1("", pitchArr, im.GetLengthArrayFloat(pitchArr), counter, "pitchFactor: " ..tostring(val.pitchFactor), 0, val.pitchFactor, im.ImVec2(400, 80))
              im.Text("Volume")
              local volumeArr = im.TableToArrayFloat(beamSounds[bi].volumeTbl)
              im.PlotLines1("", volumeArr, im.GetLengthArrayFloat(volumeArr), counter, "volumeFactor: " ..tostring(val.volumeFactor), 0, 1, im.ImVec2(400, 80))
            end
@/lua/ge/extensions/editor/gen/lib/jbeam.lua
        if ok == false then
            log('E', "jbeam.parseFile","unable to decode JSON: "..tostring(file))
            log('E', "jbeam.parseFile","JSON decoding error: "..tostring(data))
            log('E', "jbeam.parseFile","unable to decode JSON: "..tostring(file))
            log('E', "jbeam.parseFile","JSON decoding error: "..tostring(data))
            return nil
    else
        log('E', "jbeam.parseFile","unable to read file: "..tostring(file))
    end
    if not cnt then
        lo('!! ERR_PARSE:'..tostring(file))
    end
                    nbeam = 0
--                        lo('?? g_PARAM:'..tostring(cstr)..':'..tostring(cspr))
                end
                    nbeam = 0
--                        lo('?? g_PARAM:'..tostring(cstr)..':'..tostring(cspr))
                end
                inbody = true
--                    lo('?? for_BEAM:'..tostring(stamp))
--[[
--[[
--                    lo('?? '..i..':'..tostring(cdef)..':'..tostring(cstr)..':'..tostring(cspr)..':'..tostring(cdump))
                local stamp = U.stamp({(cdef or '_'),(cstr or '_'),(cspr or '_'),(cdam or '_')},true,'*')
--[[
--                    lo('?? '..i..':'..tostring(cdef)..':'..tostring(cstr)..':'..tostring(cspr)..':'..tostring(cdump))
                local stamp = U.stamp({(cdef or '_'),(cstr or '_'),(cspr or '_'),(cdam or '_')},true,'*')
--[[
--                    lo('?? '..i..':'..tostring(cdef)..':'..tostring(cstr)..':'..tostring(cspr)..':'..tostring(cdump))
                local stamp = U.stamp({(cdef or '_'),(cstr or '_'),(cspr or '_'),(cdam or '_')},true,'*')
--[[
--                    lo('?? '..i..':'..tostring(cdef)..':'..tostring(cstr)..':'..tostring(cspr)..':'..tostring(cdump))
                local stamp = U.stamp({(cdef or '_'),(cstr or '_'),(cspr or '_'),(cdam or '_')},true,'*')
    local vehData = core_vehicle_manager.getVehicleData(id)
--        dump(vehData.ioCtx.preloadedDirs,'?? part2file:'..tostring(vehData))
    jbeamIO.startLoading(vehData.ioCtx.preloadedDirs)
            if f then
                lo('?? fn:'..i..':'..flexmesh.meshName..':'..tostring(f))
            end
--            dump(p, '?? part:',nil,2)
--        lo('?? for_part:'..tostring(key)..':'..tostring(f))
        p2f[key] = {name = key, file = f, abeam = {}, amesh = {}}
--            dump(p, '?? part:',nil,2)
--        lo('?? for_part:'..tostring(key)..':'..tostring(f))
        p2f[key] = {name = key, file = f, abeam = {}, amesh = {}}
--        else
--            lo('?? no_PART:'..i..':'..tostring(b.partOrigin))
        end
@/lua/ge/extensions/editor/trafficDebug.lua
  local f = type(value) == "number" and "%0.2f" or "%s"
  if type(value) ~= "number" or type(value) ~= "string" then value = tostring(value) end
  im.BulletText(string.format(key..": "..f, value))
  im.NextColumn()
  im.TextUnformatted(tostring(trafficTotalAmount))
  im.NextColumn()
  im.NextColumn()
  im.TextUnformatted(tostring(trafficAmount))
  im.NextColumn()
  im.NextColumn()
  im.TextUnformatted(tostring(trafficActiveAmount))
  im.NextColumn()
  im.NextColumn()
  im.TextUnformatted(tostring(policeAmount))
  im.NextColumn()
  im.NextColumn()
  im.TextUnformatted(tostring(parkedAmount))
  im.NextColumn()
@/lua/ge/extensions/editor/rendererComponents.lua
  for _, s in pairs(settingNode) do
    local newPath = path .. '/' .. tostring(s.name)
    local nodeType = s.type or 'sliderFloat'
        if s.tsVar then
          --print(newPath .. ' = ' .. tostring(TorqueScriptLua.getVar(s.tsVar)) .. ' (' .. tostring(s.tsVar) .. ')')
          initialValue = tonumber(TorqueScriptLua.getVar(s.tsVar)) or 0
        if s.tsVar then
          --print(newPath .. ' = ' .. tostring(TorqueScriptLua.getVar(s.tsVar)) .. ' (' .. tostring(s.tsVar) .. ')')
          initialValue = tonumber(TorqueScriptLua.getVar(s.tsVar)) or 0
        end
        --print("initialValue = " .. tostring(initialValue))
        s.cVal = im.FloatPtr(initialValue)
      end
      if im.SliderFloat((s.title or s.name) .. '##' .. tostring(newPath), s.cVal, s.range[1], s.range[2]) then
        --print('value changed: ' .. tostring(newPath) .. ' = ' .. tostring(s.cVal[0]))
      if im.SliderFloat((s.title or s.name) .. '##' .. tostring(newPath), s.cVal, s.range[1], s.range[2]) then
        --print('value changed: ' .. tostring(newPath) .. ' = ' .. tostring(s.cVal[0]))
        if s.tsVar then
      if im.SliderFloat((s.title or s.name) .. '##' .. tostring(newPath), s.cVal, s.range[1], s.range[2]) then
        --print('value changed: ' .. tostring(newPath) .. ' = ' .. tostring(s.cVal[0]))
        if s.tsVar then
      end
      if im.Checkbox((s.title or s.name) .. '##' .. tostring(newPath), s.cVal) then
        --print('value changed: ' .. tostring(newPath) .. ' = ' .. tostring(s.cVal[0]))
      if im.Checkbox((s.title or s.name) .. '##' .. tostring(newPath), s.cVal) then
        --print('value changed: ' .. tostring(newPath) .. ' = ' .. tostring(s.cVal[0]))
        if s.tsVar then
      if im.Checkbox((s.title or s.name) .. '##' .. tostring(newPath), s.cVal) then
        --print('value changed: ' .. tostring(newPath) .. ' = ' .. tostring(s.cVal[0]))
        if s.tsVar then
        end
        --print("initialValue = " .. tostring(initialValue))
        s.cVal = initialValue

      if im.BeginCombo((s.title or s.name) .. '##' .. tostring(newPath), s.valMap[s.cVal]) then
        for ck, cv in pairs(s.values) do
            s.cVal = cv
            --print('value changed: ' .. tostring(newPath) .. ' = ' .. tostring(s.cVal))
            if s.tsVar then
            s.cVal = cv
            --print('value changed: ' .. tostring(newPath) .. ' = ' .. tostring(s.cVal))
            if s.tsVar then

      if im.ColorEdit4((s.title or s.name) .. '##' .. tostring(newPath), s.cVal) then
        if s.tsVar then
        if s.tsVar then
          local tsValStr = tostring(s.cVal[0]) .. ' ' .. tostring(s.cVal[1]) .. ' ' .. tostring(s.cVal[2]) .. ' ' .. tostring(s.cVal[3])
          rcAPI.setSetting(s.tsVar, tsValStr)
        if s.tsVar then
          local tsValStr = tostring(s.cVal[0]) .. ' ' .. tostring(s.cVal[1]) .. ' ' .. tostring(s.cVal[2]) .. ' ' .. tostring(s.cVal[3])
          rcAPI.setSetting(s.tsVar, tsValStr)
        if s.tsVar then
          local tsValStr = tostring(s.cVal[0]) .. ' ' .. tostring(s.cVal[1]) .. ' ' .. tostring(s.cVal[2]) .. ' ' .. tostring(s.cVal[3])
          rcAPI.setSetting(s.tsVar, tsValStr)
        if s.tsVar then
          local tsValStr = tostring(s.cVal[0]) .. ' ' .. tostring(s.cVal[1]) .. ' ' .. tostring(s.cVal[2]) .. ' ' .. tostring(s.cVal[3])
          rcAPI.setSetting(s.tsVar, tsValStr)
      if level == 1 then
        if im.CollapsingHeader1(tostring(s.title or s.name)) then -- newPath
          renderSettingsGui(s.settings, newPath, level)
      else
        if im.TreeNode1(tostring(s.title or s.name)) then -- newPath
          renderSettingsGui(s.settings, newPath, level)
    else
      im.TextUnformatted("TODO: unknown type: " .. tostring(nodeType))
    end
  im.Dummy(im.ImVec2(0, 5))
  if im.Checkbox('Debug##Lighting' .. tostring(newPath), tempBoolPtr) then
  end
  tempBoolPtr[0] = DOFSettings['enable'].value
  if im.Checkbox('Enable##' .. tostring(newPath), tempBoolPtr) then
    DOFSettings['enable'].value = tempBoolPtr[0]
  tempBoolPtr[0] = DOFSettings['enableDebugMode'].value
  if im.Checkbox('Debug Viz##' .. tostring(newPath), tempBoolPtr) then
    DOFSettings['enableDebugMode'].value = tempBoolPtr[0]
@/lua/vehicle/extensions/dynamicVehicleData.lua
  avgWheelPos = avgWheelPos / wheelCount --make the average of all positions
  --print("Wheels: " .. tostring(wheelCount))
  --print("Propulsed: " .. tostring(propulsedWheelsCount))
  --print("Wheels: " .. tostring(wheelCount))
  --print("Propulsed: " .. tostring(propulsedWheelsCount))
      time100200kmh = timer
      print("0-100: " .. tostring(timer))
    end
      time100200kmh = timer - time100200kmh
      print("0-200: " .. tostring(timer))
    end
      time300kmh = timer
      print("0-300: " .. tostring(timer))
    end

  print("Brake distance: " .. tostring(distance100) .. " m")

  print("Off-Road distance: " .. tostring(distance) .. " m")
  print("Off-Road beam break distance: " .. tostring(beamBrokenDistance) .. " m")
  print("Off-Road distance: " .. tostring(distance) .. " m")
  print("Off-Road beam break distance: " .. tostring(beamBrokenDistance) .. " m")
  saveInfo({["Off-Road Score"] = math.ceil(((3 * distance + beamBrokenDistance) / 500 / 4) * 100)}, {"Off-Road Score"})
@/lua/common/jbeam/expressionParser.lua
  else
    log('E', "jbeam.expressionParser.parse", "Only booleans and numbers are supported as case selectors! Defaulting to last argument... Type: " .. tostring(selectorType))
  end

  log('E', '', 'Unsupported file format: ' .. tostring(resourceURI))
  return nil, 'Unsupported file format: ' .. tostring(resourceURI)
  log('E', '', 'Unsupported file format: ' .. tostring(resourceURI))
  return nil, 'Unsupported file format: ' .. tostring(resourceURI)
end
      if label then
        print(tostring(label) ..' = ' .. tostring(val))
      else
      if label then
        print(tostring(label) ..' = ' .. tostring(val))
      else
      else
        print(tostring(val))
      end
      log('E', "jbeam.expressionParser.parse", "Failed executing expression")
      log('E', "jbeam.expressionParser.parse", '  Original:  "' .. tostring(originalExpr).. '"')
      log('E', "jbeam.expressionParser.parse", '  Processed: "return ' .. expr .. '"')
      log('E', "jbeam.expressionParser.parse", '  Processed: "return ' .. expr .. '"')
      log('E', "jbeam.expressionParser.parse", "  Error:     " .. tostring(result))
      return nil
    --syntax error most likely
    log('E', "jbeam.expressionParser.parse", "Parsing expression failed, message: " .. tostring(message))
    return nil
    --syntax error most likely
    log('E', "jbeam.expressionParser.parse", "Parsing expression failed, message: " .. tostring(message))
    return nil, nil