[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Anybody known where may be problem?
- From: Vitaly Vaghnais <vitaly.vaghnais@...>
- Date: Fri, 26 Mar 2004 17:33:31 +0200
Hello All,
I found interesting problem while I try Lua 5.0.2 (Actualy I didn't know
where is problem in my C code for working with XML files or in Lua)
I got error message: test.lua:35: attempt to perform arithmetic on a
string value
This line looks: printf("Test %d\n",1+1);
Also if I try make instand of callig printf
a=0
a=a+1
printf("And value is %d\n",a)
Result:
And value is 0
Anybody known where may be problem?
This is part of code:
...
function printf(...)
io.write(string.format(unpack(arg)))
end
function space(ix)
while ix > 0 do
ix=ix-1
printf(" ")
end
end
function enumerateBxmlTree(bxml,id,level)
local idInfo,bxmlName,bxmlValue,ids
ids = id;
if ids == nil then ids=0 end
idInfo=Bxml.enum(bxml,id)
while idInfo ~= nil do
bxmlName=Bxml.name(bxml,idInfo)
bxmlValue=Bxml.value(bxml,idInfo)
if bxmlName == nil then bxmlName="" end
if bxmlValue == nil then bxmlValue="" end
if Bxml.links(bxml,idInfo) > 0 then
space(level)
printf("<section name=\"%s\"
value=\"%s\">\n",bxmlName,bxmlValue)
enumerateBxmlTree(bxml,idInfo,level+1)
space(level)
printf("</section>\n")
else
space(level)
printf("<entry name=\"%s\" value=\"%s\"/>\n",bxmlName,bxmlValue)
end
idInfo=Bxml.enum(bxml,id,idInfo)
end
end
-- anything here is non numerical???
printf("Test %d\n",1+1);
...