From 4d6adc295fccc1573da591d5d45b86a14a10b990 Mon Sep 17 00:00:00 2001 From: Gael-de-Sailly Date: Tue, 20 Feb 2018 18:14:38 +0100 Subject: [PATCH] Added CSV reader for Lua to deal with biomes.csv and decorations.csv (not implemented yet) --- csv.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 csv.lua diff --git a/csv.lua b/csv.lua new file mode 100644 index 0000000..f9412f9 --- /dev/null +++ b/csv.lua @@ -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