Talk:OOP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (→‎Using "data tables": add meh sig)
m (add my sig properly)
Line 1: Line 1:
== Using "data tables" ==
== Using "data tables" ==
(Contains content from multiple discussions)
(Contains content from multiple discussions)
Think of '''element.data''' and '''element:getAllData'''.
Think of '''element.data''' and '''element:getAllData'''.
Line 12: Line 11:
elementData.moo = "foo2" -- works!
elementData.moo = "foo2" -- works!
</syntaxhighlight>
</syntaxhighlight>
----
--[[User:Qais|qaisjp]] ([[User talk:Qais|talk]]) 21:24, 26 November 2014 (UTC)

Revision as of 21:24, 26 November 2014

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!

--qaisjp (talk) 21:24, 26 November 2014 (UTC)