From 7689967ed60d425efd15d0d84dbc28b9fa5259d6 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Fri, 28 Mar 2014 03:19:07 +1000 Subject: A new csv2table() function. --- ClientHamr/GuiLua/skang.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index 565b642..0aeda72 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -151,6 +151,19 @@ end local _M = moduleBegin('skang', 'David Seikel', 'Copyright 2014 David Seikel', '0.1', '2014-03-27 02:57:00') print('Skang loaded, running under Lua version ' .. _VERSION) + +csv2table = function (csv) + local result = {} + local i = 1 + + for v in string.gmatch(csv, ' *([^,]+)') do + result[i] = v + i = i + 1 + end + return result +end + + -- My clever boolean check, this is the third language I've written this in. B-) -- true 1 yes ack ok one positive absolutely affirmative 'ah ha' 'shit yeah' 'why not' local isTrue = 't1aopswy' -- cgit v1.1