Jump to content




What is a table?


  • You cannot reply to this topic
7 replies to this topic

#1 FoxData

  • Members
  • 159 posts

Posted 15 March 2016 - 03:50 PM

Hi everyone. I have no idea what a table is. I know what a database table is. But not what a lua table is.

Can you please tell me what a table is?

#2 Lignum

  • Members
  • 558 posts

Posted 15 March 2016 - 04:16 PM

You're on the internet, there are plenty of sites which explain it. You just have to do a quick Google search. If you have questions about certain aspects, we're happy to answer them, but I doubt anyone would take the time to write up a post explaining the entire concept of tables.

#3 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 15 March 2016 - 04:46 PM

A lua table is something between a hashmap and an array.

In essence, a table associates two things. For example, a number with a string. Or vice versa. The value can be anything, a function, a coroutine, even another table!

Tables are useful when you want to organize some things. All APIs are actually tables, when you call os.pullEvent you are indexing the table os, with they key "pullEvent". The function associated with that key is then called.

Tables are also useful when you have an unknown or large amount of values to store. For example, if I was to create a coroutine manager, I would need to store whichever programs the user might launch. However, I don't know how many will be active at any given point.


Ignore this:

View PosteveryOS, on 15 March 2016 - 05:23 PM, said:

A table is an index where you can store multiple items

This just doesn't make any sense.

View PostLuca_S, on 22 March 2016 - 08:32 PM, said:

Ok this is scary at 05:46 PM you quoted something that was said at 06:23 PM
Is this the proper response?

Edited by KingofGamesYami, 22 March 2016 - 10:27 PM.


#4 EveryOS

  • Members
  • 570 posts
  • LocationOver there ->

Posted 15 March 2016 - 05:23 PM

A table is an index where you can store multiple items

#5 Luca_S

  • Members
  • 407 posts
  • LocationGermany

Posted 22 March 2016 - 08:32 PM

View PostKingofGamesYami, on 15 March 2016 - 04:46 PM, said:

A lua table is something between a hashmap and an array.

In essence, a table associates two things. For example, a number with a string. Or vice versa. The value can be anything, a function, a coroutine, even another table!

Tables are useful when you want to organize some things. All APIs are actually tables, when you call os.pullEvent you are indexing the table os, with they key "pullEvent". The function associated with that key is then called.

Tables are also useful when you have an unknown or large amount of values to store. For example, if I was to create a coroutine manager, I would need to store whichever programs the user might launch. However, I don't know how many will be active at any given point.


Ignore this:

View PosteveryOS, on 15 March 2016 - 05:23 PM, said:

A table is an index where you can store multiple items

This just doesn't make any sense.

Ok this is scary at 05:46 PM you quoted something that was said at 06:23 PM

#6 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 22 March 2016 - 09:33 PM

View PostLuca_S, on 22 March 2016 - 08:32 PM, said:

Ok this is scary at 05:46 PM you quoted something that was said at 06:23 PM

the power of being able to edit your post after you posted it

Edited by Lupus590, 22 March 2016 - 09:33 PM.


#7 FoxData

  • Members
  • 159 posts

Posted 22 March 2016 - 11:33 PM

Lock this thread

#8 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 23 March 2016 - 08:46 AM

View PostFoxData, on 22 March 2016 - 11:33 PM, said:

Lock this thread

The mods don't like locking threads in ask a pro, just in case someone else has the same/similar question





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users