Changes between Version 2 and Version 3 of documentation/LuaManual/Contexts

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

--

Legend:

Unmodified
Added
Removed
Modified
  • documentation/LuaManual/Contexts

    v2 v3  
    1919 
    2020{{{ 
    21 for key, doc in ipairs(context.documents:GetTable()) do 
     21for key, doc in ipairs(context.documents) do 
    2222    print doc.title 
    2323end 
    24  
    25 local index = 0 
    26 local length = #context.documents:GetTable() / 2 
    27 while index < length do 
    28     print (index .. ": " .. context.documents[index].title) 
    29 end 
    3024}}} 
    31 Because the items can be indexed by both string and integer keys, the contexts are duplicated in the table. This means that the size operator on ''context.documents:GetTable()'' returns twice as many items as there are contexts. 
    3225 
    3326It is also possible to access them as a dictionary, looking documents up by their ID: