I apologize in advance as I don't have an answer to your question but instead use your thread to ask you a question about something I am dealing with and you seem like you should be able to answer.
What do you mean about "create constants as class attributes for lua"?
I'm asking because I am currently trying to find the best way to pass a collection of values (not functions) from C to Lua and I tried using lua_val as that seemed like a plausable way based on the documentation. But I ran into two problems. 1. the data is immutable. 2. And when trying to run what I have managed to do (reference: How does lua_val work) on the console I get a crash like yours.