Changes between Version 1 and Version 2 of documentation/LuaManual/Elements

Show
Ignore:
Author:
gambini (IP: 75.131.38.166)
Timestamp:
06/09/12 07:00:08 (5 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • documentation/LuaManual/Elements

    v1 v2  
    4141There are three properties of Elements that return tables of data. They are ''child_nodes'', ''attributes'', and ''style''. They are implemented in C++ as [wiki:documentation/LuaManual/ProxyTables proxy tables] with regards to their Lua interface. 
    4242 
    43 The ''child_nodes'' property is accessed as an array; it is indexed numerically, from the front or back, and its length can be queried by getting the actual Lua table from the proxy table, and using the Lua length operator(#) on that table
     43The ''child_nodes'' property is accessed as an array; it is indexed numerically, from the front or back
    4444 
    4545''child_nodes'' is an array of element types. The array only includes visible elements; Lua has no way of querying [wiki:documentation/C++Manual/HiddenElements hidden elements]. The following example iterates over all of an element's children, printing their tag names, ids and classes: 
    4646 
    4747{{{ 
    48 for key,child in ipairs(element.child_nodes:GetTable()) do 
     48for key,child in ipairs(element.child_nodes) do 
    4949    local address = child.tag_name 
    5050 
    6767 
    6868{{{ 
    69 for name,attribute in pairs(element.attributes:GetTable()) do 
     69for name,attribute in pairs(element.attributes) do 
    7070    print key .. ": " .. attribute 
    7171end