lua-users home
lua-l archive

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

> Is there a way to temporarily change the way the lua interpreter works to
> add the necesary characters to the file as it's read?
> preferably in lua, but C would be ok too.

Sure. Just write an appropriate reader for lua_load.
The first time it's called, it should return
	"local t={}"
In subsequent calls, it should return
	"t[i]={" plus one line from the input file plus "}"
where i is the input line number.
When the input ends, return "return t".

Ask for more details if you need.