--[[ Prints all of the properties and their values for the given instance of a CEobject propertyprint(CEobject) --]] function propertyprint(ceClassObject) if type(ceClassObject) ~= 'userdata' then return end local function propertiesStringTbl(multiLineString) if type(multiLineString) ~= 'string' then return end local str = multiLineString if str:sub(-1, -1) ~= '\n' then str = str..'\n' end local newLinePositions = {} local i = 0 while true do i = string.find(str, '\n', i+1) if i == nil then break end table.insert(newLinePositions, i) end local strLines = {} for k, v in ipairs(newLinePositions) do if k == 1 then table.insert(strLines, str:sub(1, v-2)) else local ind = k-1 table.insert(strLines, str:sub(newLinePositions[ind]+1, v-2)) end end return strLines end local ceobj = ceClassObject local propertyList = getPropertyList(ceobj) local propStrTbl = propertiesStringTbl(propertyList.Text) local function _propertyprint(ceobj, indent) local obj = ceobj local ind = indent+1 local padd = string.rep('\t', ind) local pList = getPropertyList(obj) if type(pList) == 'nil' then return end local pStrList = propertiesStringTbl(pList.Text) for k, v in ipairs(pStrList) do local opv = obj[v] local strOV = tostring(opv) if strOV:sub(1, 8) == 'userdata' then strOV = '{' end print(padd..'<'..v..'> = '..strOV) if tostring(opv):sub(1, 8) == 'userdata' then _propertyprint(opv, ind) print(padd..'}') end end end for k, v in ipairs(propStrTbl) do local objName = ceobj.Name local objPropVal = ceobj[v] local strV = tostring(objPropVal) if strV:sub(1, 8) == 'userdata' then strV = '{' end print('<'..objName..'.'..v..'> = '..strV) if tostring(objPropVal):sub(1, 8) == 'userdata' then _propertyprint(objPropVal, 0) print('}') end end end registerLuaFunctionHighlight('propertyprint')