Advertisement
Masterjun

Lua, problem with tables

May 1st, 2017
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.38 KB | None | 0 0
  1. -- when you save a table in a variable, then not the values of the table get saved, only the reference to the table, meaning one write will affect the other when they have the same reference
  2.  
  3. -- example
  4. inner = {1,2,3}
  5. t = {inner,inner}
  6. t[1][2] = 123
  7. print(t[2][2]) -- prints 123
  8.  
  9. --[[
  10. most likely your
  11. NPCPreviewTable[1][2]
  12. is the same table as
  13. NPCPreviewTable[2][2]
  14. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement