lua-users home
lua-l archive

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

Hey guys,

I thought of an addition that I'd like to see in lua 3.1 before it's
released. I don't think it's very difficult. I'll add it to my own code
anyhow, I just think it's usefull enough that other people might want it

It would be cool if you could specify an identifier for lua to use in it's
debugging information when you provide a string.

Something like:

lua_dostring_with_context(char *string, char *context_name);

of course, please shorten this name as necessary.

The context_name would take the place of a filename in a lua error, or other
debugging message. This would allow me to actually track where errors came
from even if I fed lua it's information from strings.

I'd also be happy if there was just a separate function for setting the
string context before a dostring:

lua_setstringcontextname(char *context_name);
lua_dostring(char *string);

where the first would set the context for the next string evaluated (at
which time it would switch back to '<string>')


Perhaps not as trivial a change, but another one that I would use and would
like to see would be a way to specify the length instead of relying on null
termination for the string. Yeah, it's not that hard to null terminate
strings, but it would be nice if I could know that even if my data wasn't
right lua would stop at the end of a given length.

BTW, are null characters allowed in compiled lua files? If so, how does
dostring() on a compiled file know it got to the end? 

David Jeske (N9LCA) + +