Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- T = {
- }
- T[10] = 99
- T[1] = 65
- T[5] = 58
- function table.first(T)
- -- return pairs(T)(T) -- doesnt work properly, returns 10, 99
- for i = 1, table.maxn(T) do if(T[i]) then return i, T[i] end end
- end
- function table.last(T)
- return table.maxn(T), T[table.maxn(T)]
- end
- print(table.first(T))
- print(table.last(T))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement