General > Developers Corner
Learning Lua... (Just a random post from a lua super noob.)
syn.:
I haven't added anything I've made myself to the server besided some really simple custom commands because TTT is confusing and I get stuck on where to put certain things and I don't really know much about gmod lua in general, also I can't seem to get ipairs :( I'll keep trying but any small hints on Jam's puzzle would be awesome:)
JamminR:
ipairs = indexed pairs
k = (index) key
v = value
ipairs gives you both (a pair) from the table parts.
The for loop goes through the table and assigns each variable (k, v) the respective key and value.
syn.:
ohh okay so k would be the third key in the table (20) and value would be it's value?
If so then it would be: "I found 20!"
JamminR:
--- Quote from: syn. on January 26, 2014, 06:02:53 PM ---ohh okay so k would be the third key in the table (20) and value would be it's value?
If so then it would be: "I found 20!"
--- End quote ---
Partially correct. There's more output than that.
What would all the output be?
An Error Has Occurred!
array_keys(): Argument #1 ($array) must be of type array, null given
[0] Board index
Go to full version