Calculator Community > Lua

Lua Q&A

<< < (3/42) > >>

Jim Bauwens:
Its a way to loop through all the items of an Array.

Example: (works only on computer, as it uses print)

--- Code: (Lua) ---    mytable={1,2,3,"a","b","c"}

    for i, p in pairs(mytable) do
       print("Spot: " . i)
       print("Content: " . p)
    end

--- End code ---
will output

--- Code: (Lua) ---Spot: 1
Content: 1
Spot: 2
Content: 2
Spot: 3
Content: 3
Spot: 4
Content: a
Spot: 5
Content: b
Spot: 6
Content: c

--- End code ---

i is the spot in the table, p is the content of that spot.

Here is some handy information about tables: http://lua-users.org/wiki/TablesTutorial

pianoman:
Oh, I get it. Thanks, jimbauwens!

Jim Bauwens:
No problem :)

pianoman:
Sorry, but I have another one:
is there a randint feature in lua?

EDIT: Never mind, I figured it out. :)

pianoman:
Is there a way to display what the user is typing (i.e. a text box)?
I have a feeling it uses getText, but I don't know how to use it, and the TI manual is really confusing.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version