[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: bad argument #2 to `write' (string expected, got table)
- From: RLake@...
- Date: Mon, 19 Apr 2004 17:37:14 +0100
Virgil Smith excribió:
> There is indeed a second argument to "write",
you just have to know which
> "write" is being mentioned, AND you have to understand the
':' operator.
> io.write(...) evaluates to io.output():write(...).
Not actually. io.write(...) does the same thing as
io.output():write(...)
but it does not actually do the indirect evaluation...
it goes straight
to the grain, as it were. So the arguments have the
same number as
you would expect, and error messages reflect that:
> io.write({})
stdin:1: bad argument #1 to `write' (string expected,
got table)
stack traceback:
[C]: in function `write'
stdin:1: in main chunk
[C]: ?
> io.write("foo", {})
stdin:1: bad argument #2 to `write' (string expected,
got table)
stack traceback:
[C]: in function `write'
stdin:1: in main chunk
[C]: ?
foo>