Share your scripts and packages with other Mudlet users.
Post Reply
Posts: 9
Joined: Tue Jul 02, 2019 4:29 pm


Post by davidwiththenicehat » Wed Nov 13, 2019 5:48 am

Geyser.Container:objectQuery(objectTable) is a function used to collect geyser object data into multiple tables.
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 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.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" ==[k]:match("map") then --if map label is found, skip
          --debugc("Not redrawing map labels.")
        elseif "Compass." ==[k]:match("Compass.") then
          --debugc("Skip compass label"[k])
        elseif "tab" ==[k]:match("tab") or "Tab" ==[k]:match("Tab") then
          debugc("Apply tabs style sheet to: "[k])
        else --Reapply default style sheets to all other labels.
          setLabelStyleSheet([k], labelsStyle)
          debugc("Apply style sheet to: "[k])
        --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", 
  "Save client settings", true)
  cecho("") --cechoLink does not new line itself.
end --function tecRedrawLabels()
Geyser.Container:objectQuery(objectTable) code:

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:
  --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.]]--
  --debugc("Geyser.Container:objectQuery: Inserting Object data for: "
  --Collect this object data.
  table.insert(, tostring(
  table.insert(objectTable.type, tostring(self.type))
  table.insert(objectTable.parentName, tostring(
  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)

User avatar
Posts: 4728
Joined: Sat Mar 14, 2009 3:13 pm

Re: Geyser.Container:objectQuery(objectTable)

Post by Vadi » Wed Nov 13, 2019 6:10 am

Looks cool! But why would you need to recopy Geyser's data into another table, when you already have references to everything? Say for 'GUIframe.bottomRightContainer:objectQuery()' - you already know everything you put into that container.

Posts: 9
Joined: Tue Jul 02, 2019 4:29 pm

Re: Geyser.Container:objectQuery(objectTable)

Post by davidwiththenicehat » Thu Nov 14, 2019 12:26 am

Because I am using labels to draw my maps I have have something like 320 geyser objects.
Working with bulk objects.

I use GUIframe but I do not know much about it. This allows me to continue to be ignorant on its setup. I did not know the tab names without it.
Working with unknown or dynamic objects.

However my main reason is I would like to make a UI manager with free floating windows. I will want to dynamically track windows. This method creates a data structure for me to track changes.
Dynamic data collection.

Plus it was fun to write.

Posts: 9
Joined: Tue Jul 02, 2019 4:29 pm

Re: Geyser.Container:objectQuery(objectTable)

Post by davidwiththenicehat » Thu Nov 14, 2019 12:32 am

Can I get the name of a parent object from windowList? I could could do this in reverse order. Allowing people to see the gui structure if they do not know what it is. has been giving me a generic name. If I recall something along the lines of "windowContainer".

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests