Author Topic: Find nth element in a set?  (Read 3186 times)

0 Members and 1 Guest are viewing this topic.

Offline TheNlightenedOne

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 427
  • Rating: +16/-1
    • View Profile
Find nth element in a set?
« on: March 28, 2013, 11:07:10 am »
I'm using math.eval to generate a set. How do I find the nth element of that set from Lua?
"Eris" (Ndless 3.1)
"Keto" (Ndless 3.1)
"Luna" (AMS 3.10, HW4)
"Aurora" (2.55MP)

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Find nth element in a set?
« Reply #1 on: March 28, 2013, 11:17:23 am »
I'm not sure what you mean, but simply calling it the normal way would work ?

myTable[n] ?

(works in Basic and in Lua, but if done in Lua, it would require you to have var.recall()ed it first, of course...)
« Last Edit: March 28, 2013, 11:17:31 am by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline TheNlightenedOne

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 427
  • Rating: +16/-1
    • View Profile
Re: Re: Find nth element in a set?
« Reply #2 on: March 28, 2013, 12:21:28 pm »
Can I use that to randomize the order of the elements?

EDIT: nevermind, I realized I can pass a math.eval into a table as an argument. Thanks adriweb
"Eris" (Ndless 3.1)
"Keto" (Ndless 3.1)
"Luna" (AMS 3.10, HW4)
"Aurora" (2.55MP)