lua-users home
lua-l archive

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


>And you need to export lua/src/ldo.c:parse_buffer as lua_loadbuffer as well.

Right, sorry about that.

As perhaps it hasn't become clear, Lua 4.0 *already* implements lua_loadbuffer:
it's just that it's called parse_buffer and is a private (=static) function in
ldo.c. So, to have an "official" lua_loadbuffer in Lua 4.0 simply do:

1. In lua.h, duplicate the declaration of lua_dobuffer and change one copy
   to lua_loadbuffer.

2. In ldo.c, change "parse_buffer" to "lua_loadbuffer" (at 2 lines) and
   change the "static" in the definition of parse_buffer to "LUA_API".

(Jay's patch just announced does step 2.)

If you want lua_loadfile too, then repeat the steps above with "file" instead
of "buffer".
--lhf