View Single Post
06-17-15, 01:25 PM   #4
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Originally Posted by gempir View Post
Could you explain why the [1] is there?

Lua Code:
  1. SkadaDB = {
  2.     ...
  3.     ["profiles"] = {
  4.         ["Default"] = {
  5.             ["windows"] = {
  6.                 {
  7.                     ["barheight"] = 12,
  8.                     ...
  9.                 }, -- [1]
  10.                 ["x"] = -50,
  11.             },
  12.             ...
  13.         },
  14.     },
  15. }
Notice that ["barheight"] = 12 is part of a table inside the windows table, the data isn't in the windows table itself. This inner table is at index 1 of the windows table.

When you put values without keys inside a table constructor, Lua will assign them consecutive integer keys starting from 1 (i.e. they're treated like values of an array). This is explained in more detail in the Reference Manual.

Last edited by Choonstertwo : 06-17-15 at 01:25 PM. Reason: Wrong font
  Reply With Quote