How to use LUA to parse a Property file
I need help on a small LUA script that needs to parse a property file and
generate an array using string key. Here's what I tried to do;
file = assert(io.open("/root/test.prop", "r"))
property = {}
for line in file:lines() do
for key, value in string.gmatch(line, "(.-)=(%w+)") do property[key] =
value end
end
For some unknown reason only the first pair of key value is added to the
table. Since I,m new to LUA, can somebody give an hint.
No comments:
Post a Comment