Advertisement
haythammed

lua tables

Feb 10th, 2023
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. function ripairs(x)
  2. return function (t, i)
  3. if i > 1 then
  4. i = i - 1
  5. return i, t[i]
  6. else
  7. return nil
  8. end
  9. end, x, #x + 1
  10. end
  11.  
  12. for i, v in ripairs {"one", "two", "three"} do print(i, v) end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement