lua-users home
lua-l archive

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


Jacek Popławski wrote:
I am developing game "The Roots" for PC and XBox. (You can read about project
on www.theroots-game.com)

Lua works without problems on XBox, however, in "release" (i.e. not debug)
there is one missing symbol: getenv(). There is no such thing on XBox. So I
defined:

#ifdef _XBOX
#ifndef _DEBUG
char * __cdecl getenv(const char *)
{
	return 	NULL;
}
#endif
#endif

Is it possible to check in Lua source if getenv is defined, and if no - not use
it?

getenv is used twice in the Lua lib: once in baselib, to get LUA_PATH. It behaves correctly if NULL is returned.
Once in iolib, for Lua function of same name. Idem, if NULL, returns nil.
Actually, with your implementation, it is like the environment is empty, ie. all requests fails, no environment string can be found. Seems OK, since environment is system dependent anyway (and even user dependent), and behavior is true for XBox.

You should even remove getenv() from the iolib, and test if symbol is nil or not.

--
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://Phi.Lho.free.fr
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--