alestane icon

presence check iteration

alestane | PRO | 01/25/13 01:04:25 PM UTC | 0 ⭐ | 309 👁️ | Never ⏰ | []
Lua |

320 B

|

None

|

0 👍

/

0 👎

local function lookForWord( target )
 
    levelName = currentLevel..currentLevelName..".txt"
    local path = system.pathForFile(levelName, system.ResourceDirectory)
    for line in io.lines(path) do
        for word in line:gmatch( "[^,]+" ) do
            if word == target then
                return true
            end
            end
    end
    return false
end

Comments