Posted 27 October 2012 - 11:39 PM
Hi,
I wrote the following function:
at line
tmp1 = string.sub(line, 0, pos1 - 1)
I get the following error:
"attempt to perform arithmetic __sub on nil and number"
well, if I do a print(pos) before the line it prints me 3 and thats how it should be.
Can anyone tell me how to fix that?
Best Regards
Wedja
I wrote the following function:
function checkid(i, f)
local tmp1
local tmp2
local pos
file = io.open(f, "r")
if file == nil then
return 0
end
for line in file:lines()
do
pos = string.find(line, ";")
tmp1 = string.sub(line, 0, pos - 1)
tmp2 = string.sub(line, pos+1)
if tmp1 == i then
file:close()
return tonumber(tmp2)
end
end
file:close()
return 0
end
at line
tmp1 = string.sub(line, 0, pos1 - 1)
I get the following error:
"attempt to perform arithmetic __sub on nil and number"
well, if I do a print(pos) before the line it prints me 3 and thats how it should be.
Can anyone tell me how to fix that?
Best Regards
Wedja