The tables created are: name, type, parentName (Which appears to be parentType), xposition, yposition, width and height.
Usage is
objectTable = geyserObjectName:objectQuery()
objectTable or tabled contained within IE objectTable.name can be looped through to check for data.
The usage example below is using it to redraw all labels in a project that uses GUIframe.
Code: Select all
function tecRedrawLabels()
tecConfigThemes() --redo themes data. something likely changed
--Create table to store all geyser objects within GUIframe
ContainerDataTable = {
GUIframe.bottomRightContainer:objectQuery(),
GUIframe.topLeftContainer:objectQuery(),
GUIframe.bottomLeftContainer:objectQuery(),
GUIframe.bottomContainer:objectQuery(),
GUIframe.bottomRightContainer:objectQuery(),
GUIframe.topRightContainer:objectQuery(),
GUIframe.topContainer:objectQuery(),
GUIframe.topLeftTabs:objectQuery(),
GUIframe.topRightTabs:objectQuery(),
GUIframe.bottomLeftTabs:objectQuery(),
GUIframe.bottomRightTabs:objectQuery() }
--Go through all the tables we created above
for key,cdt in pairs(ContainerDataTable) do
for k,v in pairs(cdt.type) do --Check the types of containers
if v == "label" then --To see if it is a label
if "map" == cdt.name[k]:match("map") then --if map label is found, skip
--debugc("Not redrawing map labels.")
elseif "Compass." == cdt.name[k]:match("Compass.") then
--debugc("Skip compass label"..cdt.name[k])
elseif "tab" == cdt.name[k]:match("tab") or "Tab" == cdt.name[k]:match("Tab") then
setLabelStyleSheet(cdt.name[k],tabsStyle)
debugc("Apply tabs style sheet to: "..cdt.name[k])
else --Reapply default style sheets to all other labels.
setLabelStyleSheet(cdt.name[k], labelsStyle)
debugc("Apply style sheet to: "..cdt.name[k])
end
--debugc("\tTable type: "..v.." key: "..k)
end --if cdt.type is label
end --for cdt
end --for ContainerDataTable
cecho("Don't forget to save your changes with: ")
cechoLink("<:"..tecSettings.helpHighlightColor..">tecclient save\n",
[[tecFileSaveSettings(true)]],
"Save client settings", true)
cecho("") --cechoLink does not new line itself.
end --function tecRedrawLabels()
Code: Select all
function Geyser.Container:objectQuery(objectTable)
--We are addding data to this table each loop.
--We assume first run if a table is not passed. So we created the table.
objectTable = objectTable or
{name={}, type={}, parentName={}, xPos={}, yPos={}
,width={}, height={}}
--windowList reference: https://www.mudlet.org/geyser/files/geyser/GeyserContainer.html
--Loop through all children of this container.
for k,v in pairs(self.windowList) do
if k ~= self then --if the key is not this geyser object
objectTable = v:objectQuery(objectTable) --query that object.
end --end if k not = self check
end --end for loop pair(self.windowlist)
--[[this.object logic can SEEM confusing. It's not.
At this point we have reach the 'bottom' of ourcontainer query.
So the last child with the last alphabetical name.
We insert our object data. Than return it. Meaning this now occurs for the second to
the last geyser object, and so on until we reach the parent that called the query.]]--
--https://wiki.mudlet.org/w/Manual:Lua_Functions#debugc
--debugc("Geyser.Container:objectQuery: Inserting Object data for: "..self.name)
--Collect this object data.
--Reference: https://www.mudlet.org/geyser/files/geyser/GeyserContainer.html
table.insert(objectTable.name, tostring(self.name))
table.insert(objectTable.type, tostring(self.type))
table.insert(objectTable.parentName, tostring(self.parent.name))
table.insert(objectTable.xPos, tostring(self:get_x()))
table.insert(objectTable.yPos, tostring(self:get_y()))
table.insert(objectTable.width, tostring(self:get_width()))
table.insert(objectTable.height, tostring(self:get_height()))
return objectTable --return the table to the object that called this object
end --Geyser.Container:objectQuery(objectTable)