Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How see all attributes of "display"?
Started by sieler2 Oct 26 2017 07:03 PM

5 replies to this topic
display table.show contentwidth
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

sieler2

[GLOBAL: userInfoPane.html]
sieler2
  • Contributor

  • 108 posts
  • Corona SDK

Hi,
 
I'm trying to find all the attributes of an object ... in this case, 'display'. 
 
I'm using Julio Manuel Fernandez-Diaz's "table.show" and it shows a lot...
 
but...
 
I *don't* see things like "display.contentWidth", which I know exists (since I can get and set it :)
 
(I was trying to ascertain which fields, on MacOS, would have the new window
width and height after a resize, since it's not contentWidth & contentHeight
(hmmm...unless they do have the same, implying the window's scale changed!))
 
Why don't I see contentWidth?   How can I see *all* fields/attributes/tags/indices/whatever-you-call-them?
 
thanks,
 
Stan
 
At the time of the following, the display.contentWidth and contentHeight report at being 4096 and 2048 respectively.
 
print (show_table (display, "", "   ")) -->
 
Oct 26 07:50:03.227     = {
                          ["BottomRightReferencePoint"] = "userdata: 0x10f8d0977";
                          ["HiddenStatusBar"] = "userdata: 0x10f8d08d8";
                          ["setDrawMode"] = "function: 0x6080004619c0, C function";
                          ["save"] = "function: 0x608000071f40, C function";
                          ["newPolygon"] = "function: 0x608000072cc0, C function";
                          ["newText"] = "function: 0x60800006e1c0, C function";
                          ["newRetinaText"] = "function: 0x60800024f840, defined in (522-525)=?";
                          ["captureScreen"] = "function: 0x608000071380, C function";
                          ["newMesh"] = "function: 0x60800046a800, C function";
                          ["newImage"] = "function: 0x608000274a80, C function";
                          ["capture"] = "function: 0x608000077d80, C function";
                          ["revision"] = 1;
                          ["newSnapshot"] = "function: 0x608000274f00, C function";
                          ["newRect"] = "function: 0x608000460d40, C function";
                          ["_newContainer"] = "function: 0x60800007fe40, C function";
                          ["newGroup"] = "function: 0x608000071600, C function";
                          ["name"] = "display";
                          ["newSprite"] = "function: 0x608000276380, C function";
                          ["TopRightReferencePoint"] = "userdata: 0x10f8d0975";
                          ["__metatableOrig"] = {
                             ["super"] = {
                                ["setCurrentProvider"] = "function: 0x608000052150, defined in (123-143)=?";
                                ["getProvider"] = "function: 0x60800004e340, defined in (113-115)=?";
                                ["class"] = {}; -- ["__metatableOrig"]["super"] (self reference)
                                ["super"] = {
                                   ["newClass"] = "function: 0x60800005cbf0, defined in (101-117)=?";
                                   ["setExtension"] = "function: 0x6080002545b0, defined in (124-163)=?";
                                   ["class"] = {}; -- ["__metatableOrig"]["super"]["super"] (self reference)
                                   ["_defaults"] = {
                                      ["newClassOptions"] = {};
                                      ["anonymousCount"] = 0;
                                   };
                                   ["super"] = {}; -- ["__metatableOrig"]["super"]["super"] (self reference)
                                   ["isClass"] = "function: 0x60800004db60, defined in (119-122)=?";
                                   ["initialize"] = "function: 0x608000255150, defined in (91-93)=?";
                                   ["instanceOf"] = "function: 0x608000245070, defined in (165-190)=?";
                                   ["isRoot"] = "function: 0x6080000520c0, defined in (192-194)=?";
                                   ["__index"] = {}; -- ["__metatableOrig"]["super"]["super"] (self reference)
                                   ["new"] = "function: 0x60800005aeb0, defined in (55-89)=?";
                                };
                                ["shouldNewConvertFirstParameterToInstance"] = true;
                                ["publisherId"] = "anonymous";
                                ["getCurrentProvider"] = "function: 0x60800005ea20, defined in (118-120)=?";
                                ["__index"] = {}; -- ["__metatableOrig"]["super"] (self reference)
                                ["new"] = "function: 0x60800005a250, defined in (23-37)=?";
                                ["revision"] = 1;
                                ["providerNameToModuleName"] = "function: 0x608000243840, defined in (83-91)=?";
                                ["version"] = 1;
                                ["initialize"] = "function: 0x608000461b00, defined in (39-65)=?";
                                ["requireProvider"] = "function: 0x608000243120, defined in (96-111)=?";
                                ["__metatableOrig"] = {}; -- ["__metatableOrig"]["super"]["super"] (self reference)
                                ["initializeProvider"] = "function: 0x608000244800, defined in (67-81)=?";
                                ["name"] = "anonymous";
                             };
                             ["name"] = "display";
                             ["class"] = {}; -- ["__metatableOrig"] (self reference)
                             ["__index"] = {}; -- ["__metatableOrig"] (self reference)
                             ["__metatableOrig"] = {}; -- ["__metatableOrig"]["super"] (self reference)
                          };
                          ["LightTransparentStatusBar"] = "userdata: 0x10f8d08dc";
                          ["remove"] = "function: 0x60800005d5b0, defined in (512-519)=?";
                          ["CenterRightReferencePoint"] = "userdata: 0x10f8d0976";
                          ["CenterLeftReferencePoint"] = "userdata: 0x10f8d097a";
                          ["BottomLeftReferencePoint"] = "userdata: 0x10f8d0979";
                          ["newRoundedRect"] = "function: 0x608000274580, C function";
                          ["BottomCenterReferencePoint"] = "userdata: 0x10f8d0978";
                          ["TranslucentStatusBar"] = "userdata: 0x10f8d08da";
                          ["loadRemoteImage"] = "function: 0x608000256920, defined in (468-509)=?";
                          ["newImageRect"] = "function: 0x608000463e80, C function";
                          ["publisherId"] = "com.coronalabs";
                          ["TopCenterReferencePoint"] = "userdata: 0x10f8d0974";
                          ["getDefault"] = "function: 0x6080002760c0, C function";
                          ["__index"] = {}; --  (self reference)
                          ["newCircle"] = "function: 0x608000466280, C function";
                          ["TopLeftReferencePoint"] = "userdata: 0x10f8d0973";
                          ["setDefault"] = "function: 0x608000468a00, C function";
                          ["getCurrentStage"] = "function: 0x60800027fcc0, C function";
                          ["CenterReferencePoint"] = "userdata: 0x10f8d0972";
                          ["DarkTransparentStatusBar"] = "userdata: 0x10f8d08dd";
                          ["newContainer"] = "function: 0x60800007fb00, C function";
                          ["DarkStatusBar"] = "userdata: 0x10f8d08db";
                          ["DefaultStatusBar"] = "userdata: 0x10f8d08d9";
                          ["class"] = {}; -- ["__metatableOrig"] (self reference)
                          ["colorSample"] = "function: 0x60800026d000, C function";
                          ["captureBounds"] = "function: 0x608000072a40, C function";
                          ["version"] = 1;
                          ["setStatusBar"] = "function: 0x60800026da40, C function";
                          ["newLine"] = "function: 0x60800026da00, C function";
                          ["newEmbossedText"] = "function: 0x60800007fbc0, C function";
                          ["newEmitter"] = "function: 0x60800026e540, C function";
                       };
                    ["__metatableOrig"]["super"]["class"] = ["__metatableOrig"]["super"];
                    ["__metatableOrig"]["super"]["super"]["class"] = ["__metatableOrig"]["super"]["super"];
                    ["__metatableOrig"]["super"]["super"]["super"] = ["__metatableOrig"]["super"]["super"];
                    ["__metatableOrig"]["super"]["super"]["__index"] = ["__metatableOrig"]["super"]["super"];
                    ["__metatableOrig"]["super"]["__index"] = ["__metatableOrig"]["super"];
                    ["__metatableOrig"]["super"]["__metatableOrig"] = ["__metatableOrig"]["super"]["super"];
                    ["__metatableOrig"]["class"] = ["__metatableOrig"];
                    ["__metatableOrig"]["__index"] = ["__metatableOrig"];
                    ["__metatableOrig"]["__metatableOrig"] = ["__metatableOrig"]["super"];
                    ["__index"] = ;
                    ["class"] = ["__metatableOrig"];
 


[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,591 posts
  • Corona SDK

1. AFAIK there is no way to dump those fields unless you have modified them.  i.e. They are hidden from the pairs iterator unless you modified them.  They may even stay hidden (from the iterator) if you change them.

 

2. Welcome to the community and the forums.

 

2. Please use the code formatting button next time.

 

formatyourcode.jpg



[TOPIC: post.html]
#3

sieler2

[GLOBAL: userInfoPane.html]
sieler2
  • Contributor

  • 108 posts
  • Corona SDK

Roaminggamer:

 

1. darn.

 

2. thanks!

 

3. will do.  I was a bit conflicted, since to me output isn't code :)

(ok, and I missed seeing the "<>" before!)

 

thanks again,

 

Stan



[TOPIC: post.html]
#4

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,591 posts
  • Corona SDK

re: #3 you have a valid point.  It's a bit of a knee jerk reaction for me when I see long pastes of 'stuff'.  



[TOPIC: post.html]
#5

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 817 posts
  • Corona SDK

The values are being synthesized by the metatable's __index function, which will be called (or indexed, if a table) when a key isn't found in your object. If there's a result, you get that back.

 

Very roughly, this is what's going on under the hood:

local mt = {
  __index = function(object, key)
    if key == "contentWidth" then
      return object.width * 5
    end
  end
}

local object = setmetatable({ width = 10 }, mt)

print("WIDTH?", object.width) -- prints 10
print("CONTENT WIDTH?", object.contentWidth) -- prints 50
print("OTHER?", object.other) -- prints nil


[TOPIC: post.html]
#6

sieler2

[GLOBAL: userInfoPane.html]
sieler2
  • Contributor

  • 108 posts
  • Corona SDK

thanks, StarCrunch!

 

Although I'm wildly impressed by how easy it's been to get apps going with Corona SDK (for Android and Mac), I do admit to a strong tendency to "look under the hood" a lot :)

 

Stan




[topic_controls]
[/topic_controls]