Advertisement
alestane

Generalized map loader

Jan 1st, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. return function (mapfile, terrains)
  2.     local new = {}
  3.     for line in io.lines(mapfile) do
  4.         local h = 1
  5.         local row = {}
  6.         for point in line:gmatch('.') do
  7.             row[h] = terrains[point]
  8.             h = h + 1
  9.         end
  10.         table.insert(new, row)
  11.     end
  12.     return new
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement