I've been playing around with prefixing the scripts I load with startup
code. This I've been doing with lua_load() and chunks. I've come
across the problem that if I want to flag a specific error in the code
that the user wrote I want to be able to tell them in which line number
in /their/ code this error occurred on.
Is the only way to do this to scan the characters for \r?\n before they
reach lua_load()?
Unfortunately, I cannot see a better way. Just be careful to translate \r and
\n to a space, instead of deleting them...
Also, if this is the case, is there some means of
solving this when loading a pre-compiled lua chunk?
How so? Text and pre-compiled chunks cannot be mixed. The code that loads
pre-compiled chunks stops as soon as it loads the chunk; it loads only one
chunk. Unless you're pretty intimate with the format of pre-compiled chunks,
there's not much you can change. And even if you are, changing something will
require code equivalent to loading the pre-compiled chunk...