lua-users home
lua-l archive

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


solved :) it was a compilation problem :)

On Mon, Apr 19, 2004 at 11:19:50AM -0500, Virgil Smith wrote:
-- A partial answer...
-- 
-- 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(...).
-- 
-- io.output() returns the current "default" output file.
-- 
-- io.output():write(...) is "syntactic sugar" for io.output().write(self, ...)
-- where "self" is the table or userdata corresponding to io.output().
-- 
-- 
-- This points out that the "write" in question is file.write, not io.write,
-- and it explains why "argument #2" is referenced.
-- What it does NOT explain is why that argument "got table" rather than the
-- string supplied.
-- 
-- 
-- 
-- 
-- 
-- -----Original Message-----
-- From: lua-bounces@bazar2.conectiva.com.br
-- [mailto:lua-bounces@bazar2.conectiva.com.br]On Behalf Of pancake
-- Sent: Monday, April 19, 2004 10:11 AM
-- To: Lua list
-- Subject: bad argument #2 to `write' (string expected, got table)
-- 
-- 
-- I'm glad about one error message given my lua5.0.2.
-- 
-- I tested that on NetBSD-current and FreeBSD-5.2:
-- 
-- I also test running lua as dynamic and static, and allways the same error:
-- 
-- [1:~]# cat /tmp/luaerr
-- print("ImOK");
-- io.write("IFAIL!\n");
-- print("IGNOREME");
-- [1:~]# lua /tmp/luaerr
-- ImOK
-- IFAIL!
-- lua: /tmp/luaerr:2: bad argument #2 to `write' (string expected, got table)
-- stack traceback:
--         [C]: in function `write'
--         /tmp/luaerr:2: in main chunk
--         [C]: ?
-- [1:~]#
-- 
-- 
-- it's really strange...there's not second argument to write...why it gives
-- that error?
-- 
-- it's a bug?
-- 
--