[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua.c
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 13 Dec 2001 01:14:37 -0200
The work version of lua.c at http://www.tecgraf.puc-rio.br/lua/work/lua.c
can be run with Lua 4.0, with the following simple changes:
1. In lua.c, after #include "lua.h" add the following lines:
#define lua_pushliteral(L, s) \
lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
#define lua_upvalueindex(i) (-(i))
#define lua_newuserdatabox lua_pushuserdata
LUA_API int lua_loadbuffer (lua_State *L, const char *buff, size_t size,
const char *name);
2. In lua.c, in load_string, before lua_concat, add the following line:
lua_pushstring(L, " ");
(Apparently, lua_concat(L,n) in 4.0 does not work for n=1.)
3. In ldo.c, change
static int parse_buffer
to
LUA_API int lua_loadbuffer
This will give you a nicer interpreter for the official Lua version.
(The readline support should also work: compile with -DUSE_READLINE and
link with -lreadline and perhaps also with -lhistory.)
Enjoy!