alestane

presence check iteration

Jan 25th, 2013
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function lookForWord( target )
  2.  
  3.     levelName = currentLevel..currentLevelName..".txt"
  4.     local path = system.pathForFile(levelName, system.ResourceDirectory)
  5.     for line in io.lines(path) do
  6.         for word in line:gmatch( "[^,]+" ) do
  7.             if word == target then
  8.                 return true
  9.             end
  10.             end
  11.     end
  12.     return false
  13. end
Advertisement
Add Comment
Please, Sign In to add comment