[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Detect that code is executing under Lua.exe
- From: thomas.lavergne@...
- Date: Mon, 27 Mar 2006 19:47:39 +0200
A simple way to do this is to use the LUA_INIT environement variable.
Call the lua interpreter this way
LUA_INIT='_LUAINTERPRETER=true' /usr/local/lua
I don't know how to do it on windows, but you surely have a way to do
this, perhaps with a bat script.
Tom
On Mon, Mar 27, 2006 at 08:28:41PM +0400, Alexander Gladysh wrote:
> Hi, all!
>
> Lua 5.0.2
>
> I'm writing some code, which uses my own 'low-level' lua libraries. It
> is convenient for me to use lua.exe for testing of this code in
> following maner:
>
> $> lua.exe
> > dofile("MyFile.lua")
> > ... do something
> (fix MyFile.lua)
> >dofile("MyFile.lua")
> > ... do something
>
> I'm calling dofile(MyFile.lua) often and without restarting of the
> environment, and that conflicts with some assumptions taken in my
> libraries. I'd like to tweak them for such case.
>
> To do this I need to know if I'm running under lua.exe or in my
> engine. Lua.exe does not export anything valuable in such sense to
> Lua. It would be nice to have, say _LUAINTERPRETER global variable
> (like _VERSION).
>
> Other option is to have the way to reset environment in the lua.exe,
> but AFAIK it have no such feature. Restarting lua.exe each time is
> inconvenient, since I'd loose all console history in this way (it
> would help if it would have an option to save console history between
> sessions).
>
> I know I can make such tweaks myself in my local copy of lua.exe
> sources, but I think these small convenience features would be useful
> for other users.
>
> Thanks in advance,
> Alexander.
--
Thomas Lavergne "Le vrai rêveur est celui qui rêve
de l'impossible." (Elsa Triolet)
thomas.lavergne@reveurs.org http://reveurs.org