Added CSV reader for Lua

to deal with biomes.csv and decorations.csv
(not implemented yet)
master
Gael-de-Sailly 2018-02-20 18:14:38 +01:00
parent bb86f054e0
commit 4d6adc295f
1 changed files with 12 additions and 0 deletions

12
csv.lua Normal file
View File

@ -0,0 +1,12 @@
local function read_csv(path)
local file = io.open(path, "r")
local t = {}
for line in file:lines() do
if line:sub(1,1) ~= "#" and line:find("[^%,% ]") then
table.insert(t, line:split(",", true))
end
end
return t
end
return read_csv