Lua3.1 last minute addition?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua3.1 last minute addition?

David Jeske-2
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
also.

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) + http://www.chat.net/~jeske/ + [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Lua3.1 last minute addition?

David Jeske-2
Sorry, I realized this sounded confusing. This was supposed to read as
either the top of the bottom method, not both.


On Mon, Jun 15, 1998 at 05:02:59AM -0300, David Jeske wrote:
> lua_dostring_with_context(char *string, char *context_name);

_or_

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

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + [hidden email]