lua-users home
lua-l archive

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


在 2017/2/26 11:51, Charles Heywood 写道:
> LUA_INIT is Lua code meant to run before other Lua code. If you wanted,you could probably nuke the entire standard library. I don't see why just because it can be "broken" it might be a misfeature.
>
> On Sat, Feb 25, 2017 at 2:42 PM Soni L. <fakedme@gmail.com <mailto:fakedme@gmail.com>> wrote:
>
>     [soniex2@soniex-pc lua]$ cat init.lua
>     local _require = require
>     require = function(...)
>        print(...)
>        return _require(...)
>     end
>     [soniex2@soniex-pc lua]$ LUA_INIT='@init.lua' lua -l init
>     init
>     Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
>      > ^C
>     [soniex2@soniex-pc lua]$
>
>     Is this intended?
>
>     --
>     Disclaimer: these emails may be made public at any given time, withor without reason. If you don't agree with this, DO NOT REPLY.
>
>
> --
> --
>
> Ryan <vandor2012@gmail.com <mailto:vandor2012@gmail.com>>
> Software Developer / System Administrator
> https://hashbang.sh

the environment variables are checked and loaded by the standalone interpreter, not the Lua core library.

for applications written to run via the standalone interpreter (instead of some host program embedding liblua),
arbitrary scripts can execute before the application, which may or may not cause problems.

maybe we can add a command line switch to disable environment variable processing?


-- 
the nerdy Peng / 书呆彭 /