Thread Tools Display Modes
Prev Previous Post   Next Post Next
05-16-20, 08:03 AM   #1
jettisonedintospace
A Defias Bandit
Join Date: Aug 2019
Posts: 2
Question Table > how to pick or skip values?

hi,

I've searched for a few hours in vain here and on the web but I fail to pick the proper keywords to find the answer for my question.

Lua Code:
  1. table = {
  2.         [1] = "One",
  3.         [2] = "Two",
  4.         [3] = "Three",
  5.         [4] = "Four",
  6.         [5] = "Five",
  7.     }
  8.     for i=1, 3 do
  9.         table[i] = DEFAULT_CHAT_FRAME:AddMessage("test"..tostring(i))
  10.     end

will print:
test1
test2
test3

but what if I want to print:
test1
test2
test4
test5

how to skip a value?

or pick only a few that are not consecutive?

like for:
test2
test5
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Table > how to pick or skip values?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off