Hidden Features |
|
=== newproxy function ===newproxy is an unsupported and undocumented function in the Lua base library. From Lua code, the setmetatable function may only be used on objects of table type. The newproxy function circumvents that limitation by creating a zero-size userdata and setting either a new, empty metatable on it or using the metatable of another newproxy instance. We are then free to modify the metatable from Lua. This is the only way to create a proxy object from Lua which honors certain metamethods, such as __len. Synopsis:
See also [1][2] . === The frontier pattern %f ===See FrontierPattern concerning %f in patterns. |
|
=== package.config === |
|
=== Old items === |
|
LuaList:2006-07/msg00089.html (will be documentedin 5.2) |
|
* lua_pushliteral is now documented in 5.1.3: [1][3][4] * The FrontierPattern was added to the reference manual in Lua 5.2. [2] |
|
=== Old items === |
|
* The undocumented newproxy function was removed in Lua 5.2, since it was made redundant by other features added in that version. |
|
lua_pushliteral is now documented in 5.1.3: [1][2] |
|
* Documentation for package.config was added in Lua 5.2. [1] |
As of 5.1.3, it is not permitted to close a standard file (e.g. stdin, stdout, and stderr) due to a bug this can cause[1][5]:
> assert(io.stdout:close()) stdin:1: cannot close standard file
Here's a hack around that, which should be used with caution:
local f = assert(io.open '/dev/null') -- or possibly NUL on Windows debug.setfenv(io.stdout, debug.getfenv(f)) f:close() assert(io.stdout:close()) -- ok