~ubuntu-branches/debian/wheezy/mudlet/wheezy

« back to all changes in this revision

Viewing changes to src/mudlet-lua/lua/geyser/GeyserUtil.lua

  • Committer: Bazaar Package Importer
  • Author(s): Craig Small
  • Date: 2011-05-14 20:12:49 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110514201249-184gqx5jjqam02lg
Tags: 2.0-rc5-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
        end
59
59
        return copy
60
60
end
61
 
 
62
 
---Checks whether a table contains a value or not
63
 
function table.contains(table, element)
64
 
  for _, value in pairs(table) do
65
 
    if value == element then
66
 
      return true
67
 
    end
68
 
  end
69
 
  return false
70
 
end
71
 
 
72
 
---Returns the index of the value in a table
73
 
function table.index_of(table, element)
74
 
  for index, value in ipairs(table) do
75
 
    if value == element then
76
 
      return index
77
 
    end
78
 
  end
79
 
  return nil
80
 
end
 
 
b'\\ No newline at end of file'