View Single Post
11/11/14, 10:31 AM   #4
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Everything that's not local is global. Simple as that. Scope has nothing to do with the type of values you can store in variables.

Lua Code:
  1. g_str = "hello world" -- string stored in global var
  2. g_num = 5 -- number
  3. g_tab = { foo = 5, bar = 7} -- table

Tables are a hybrid between what other languages call dictionary/mapping/hashtable and list/array/vector. Lua likes to look smart, so you can have a table indexed by any type of value, or even a mix of types (strings, numbers, even functions). If you happen to use a contiguous sequence of numbers 1..N as indices, it happens to be an indexed array. I suggest you read a lot, and carefully, about tables, they might be a bit tough to grasp at first, but in the end the hybrid nature makes them super easy to use
  Reply With Quote