[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: t._NAME etc.
- From: Thomas Lauer <thomas.lauer@...>
- Date: Fri, 23 Mar 2007 12:34:30 +0000
I'm implementing a module-supporting "strict" system, along the lines of
strict.lua. The code so far looks good though there's a small, almost
cosmetic problem. The error messages printed (from Roberto's code) are:
error("assign to undeclared variable '"..n.."'", 2)
and
error("variable '"..n.."' is not declared", 2)
with n being the name of the culprit.
However, if the error occurs in connection with a module (if, for
example, someone refers to a non-existent function or variable in a
module), the message doesn't show the name of the module. For all
user-defined modules this is in module._NAME, so I can easily retrieve
and print it.
Alas, the tables for the standard library (the "pseudo modules" like os,
string etc.) do not come with a _NAME field. (There's also no _M and
_PACKAGE.) It would be nice (read: consistent:-)) if the standard
modules could be made to behave, as far as possible, like user-defined
modules. (There are perhaps other areas with other small differences
which I, being new to Lua, have not yet explored.)
For the time being I have q&d-patched these fields into my code, but if
there's no specific reason against, could this be added in a future Lua
release?
--
cheers thomasl
web : http://thomaslauer.com/start
- References:
- Re: Use of Lua corotines in games, Steven Johnson
- What's wrong here?, Thomas Lauer
- Re: What's wrong here?, Kristofer Karlsson
- Re: What's wrong here?, Julien Hamaide
- Lua 5.1.1 LOADNIL optimization bug (was: What's wrong here?), Mike Pall
- Re: Lua 5.1.1 LOADNIL optimization bug, Julien Hamaide
- Re: Lua 5.1.1 LOADNIL optimization bug, Mike Pall
- Environments, Eva Schmidt
- Re: Environments, Alex Queiroz
- Re: Environments, Eva Schmidt
- Re: Environments, Eike Decker