[vbezobiuk@vbezobiuk ~]$ lua5.1
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> setmetatable(_G,{__index=function(...)print(...)end})
table: 0x10476b0 _PROMPT
here it is. lua cli requests the global variable _PROMPT :) and os.getenv needs string as it's first argument
the prompt is not set by default (that's why __index got triggered)
probably you wanted something like:
[vbezobiuk@vbezobiuk ~]$ lua5.1
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> setmetatable(_G,{__index=function(...) return os.getenv(select(2,...)) end})
> =HOME
/home/vbezobiuk
>