Jump to content




Unpack


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

#1 Rougeminner

  • Members
  • 151 posts

Posted 25 January 2015 - 04:31 PM

I need some help with unpack. my goal is to get a specific table element. once i find that element i want to get the values associated to it in the table. my problem lies on the unpack statement i want the line print("It should print right here",unpack(vectors[detail])) here is a link to pastern code http://www.pastebin.com/twM2Y0iU Please help me. i am going crazy trying to figure this out.

#2 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 25 January 2015 - 04:46 PM

In your pastebin you are "calling" unpack with
unpack { vectors[detail] }
I'm pretty sure you want to do this:
unpack( vectors[detail] )
because what you are doing is putting your table into another table, and unpack one layer, which is as if you would write:
vectors[detail]
which will be your table/3d-vector containing you 3 dimension values parsed before

So your code formatted properly:
Spoiler


#3 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 25 January 2015 - 05:43 PM

Another way to do it would be the following:
vector[detail] = {15, 12, 7}

print("your string", vector[detail][1], vector[detail][2], vector[detail][3])






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users