Discussion Lua tables to replace arrays?

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Shadowblitz16, Jan 7, 2019.

Tags:
  1. Shadowblitz16

    Shadowblitz16 Member

    Joined:
    Jun 23, 2016
    Posts:
    587
    I was wondering if at some point yoyo games would think about replacing arrays entirely with lua tables?

    they would basically be the same thing but would also be able to hold key pair values.
    so it would look something like this..
    Code:
    var table1 = { "hi", 0 } //list or array
    var table2 = {} //map
          table2.string = table1[0]
    
    show_debug,message(table2.string)
    
    now I know this would only be doable if it was equal or faster then the speed of an array or if types were ever added.
    but if luajit uses tables and is fast then i don't see why this couldn't be done
     
  2. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    3,405
    That's what a map is for.

    Promoting data structures to true data types is on the Roadmap, but don't hold your breath for it.
     
  3. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    170
    Hi. I've been seeing this for a while. Does this mean that instead of accessing a map via a variable, we access it directly?
     
  4. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    3,405
    Think of the Roadmap's goal on that item as how arrays now work post-GMS-1.3. You're still dealing with a reference, just with access to the garbage collector and more built-in type safety.
     
  5. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,066

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice