Here's a patch I've long maintained for lua.c to save command-line history when lua.c is compiled with a suitable libreadline and libhistory.
I'm interested in comments about whether it would be welcome and useful in the default lua.c.
I have continued to maintain and use this patch ever since, and it still works fine for me today. It's simple and short.
I wrote about some possible shortcomings in the list post in 2007, but I have not needed to address any of them since then. The most obvious one which might confuse or annoy users as it stands is that it saves the history in the current working directory, whereas REPLs typically save history in the user's home directory. This is easy to fix (set LUA_HISTORY in your environment, as I do, to ~/.lua_history), and avoids a lot of extra code to deal with finding the user's home directory, which lua.c doesn't currently do.