lua-users home
lua-l archive

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

>I have changed my lua v4.0 so I can use lua_loadbuffer (was parse_buffer).
>What happens if I call this function, change the script in the passed
>buffer, and then call it again?  Is that allowed?

Yes, it's allowed. Every time you call lua_loadbuffer, a new function
corresponding to the compiled script in the buffer is left on the stack.

>Would then calling lua_dobuffer do the second loaded scipt, or not?

After lua_loadbuffer you want to call lua_call not lua_dobuffer.
lua_dobuffer is essentially lua_loadbuffer followed by lua_call: