your-own-drum/text.lua

17 lines
370 B
Lua

--Load poems.
local love = love
local txt = {}
local info = love.filesystem.getInfo( "text" )
for _, filename in ipairs(love.filesystem.getDirectoryItems( "text" )) do
local s = love.filesystem.read( "text/"..filename )
local t = {}
local i = 1
for w in s:gmatch( "%a+") do
t[i] = w
i = i + 1
end
txt[filename:gsub( ".txt", "" )] = t
end
return txt