lua-users home
lua-l archive

Re: lua.c

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


>Lua 4.1 (beta) Copyright (C) 1994-2001 TeCGraf, PUC-Rio
>> a = {"what", "ever"}
>> for i = 1, getn(a) do
>>> print(a[i])
>error: `do' expected;
> last token read: `doprint' at line 1 in stdin
As far as I could determine, this only happens when you build lua.c with
-DUSE_READLINE, that is, to use GNU readline.
I missed the following sentence in realine's man page:
 The line returned has the final newline removed, so only the text of
 the line remains.
I assumed readline kept the \n at the end of the string. Sorry about that.
I'll correct the code. For the time being, here is a quick fix (tested):
In load_string add
#ifdef USE_READLINE
 lua_pushstring(L, "\n");
#endif
before
 lua_concat(L, lua_gettop(L)-2);
Thanks for the report.
--lhf

AltStyle によって変換されたページ (->オリジナル) /