STAR TREK 2d20

Thread: Control type

  1. #1
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    253

    Control type

    Using getControls () I get a table whose elements look something like this:
    Code:
    {#1 = subwindow = { name = s'header', x,y,w,h = 15,23,520,0 }, #2 = genericcontrol = { name = s'contentframe', x,y,w,h = 0,0,0,0}, ... }
    Is there a way to know the type of each control?
    I need to know if it's a subwindow, a genericcontrol or whatever. Not the name, but the type.
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    Use the LUA type function - this has been "Extended to cover FG Lua object types" as mentioned here: https://fantasygroundsunity.atlassia...ic-Lua-Changes
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    253
    I think I'm doing something wrong
    Code:
    for _, c in pairs(self.getControls()) do
       Debug.console("TYPE ===",c, c.type, _);
    end;
    This is what I get
    Code:
    s'TYPE ===' | subwindow = { name = s'header', x,y,w,h = 15,23,460,0 } | fn | #1
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  4. #4
    The information displayed for custom FG data types are not actual Lua tables that you can query (even if the output mimics the output of tables).

    Code:
    for k, c in pairs(self.getControls()) do
        Debug.console("TYPE ===", c, type(c), k);
    end;
    Regards,
    JPG

  5. #5
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    253
    Great!

    Ty
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in