[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Detect that code is executing under Lua.exe
- From: "Alexander Gladysh" <agladysh@...>
- Date: Mon, 27 Mar 2006 20:28:41 +0400
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.