lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

This is my first email and fyi i am very new born in Lua.

Now the question is;

why does the below code gives me

"error: bad argument #1 to `write' (string expected, got nil)
stack traceback:
   1:  function `write' [C]
   2:  main of file `ask.lua' at line 10

Error: Script failed"

this???

--case.lua

function foo (rt, from, s)
 for i=1,10 do
  tinsert (rt, from, strsub(s,i,i+1))
 end
end
local combi = {}
local var1 = {"1234567890"}
foo(combi, 34, var1[1])
write (combi[34], "\n")
write (combi[35], "\n")  --this guy has a problem

--EOF

and combi[34] writes 0 ??

TIA
Volkan



Do You Yahoo!?
Make a great connection at Yahoo! Personals.