Talk:OOP

From Multi Theft Auto: Wiki
Revision as of 21:24, 26 November 2014 by Qaisjp (talk | contribs) (→‎Using "data tables": new section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Using "data tables"

(Contains content from multiple discussions) Think of element.data and element:getAllData.

  • variables return a referenced table
  • function returns a copy
element.data.moo = "foo" -- works!
element:getAllData().moo = "foo" -- doesn't work!

local elementData = element.data
elementData.moo = "foo2" -- works!