lua-users home
lua-l archive

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


Hi all!
I really would have asked this some time ago, but this quick switch from work5 to alpha was quite a surprise (for me - my bad :-) ), so I hope my question/curiosity/(request?) isn't too late.

I noticed that Lua's build is quite customizable through luaconf.h, so I wonder how a script can detect the different options used to compile the Lua interpreter under it is running.

Somehow I would expect that an highly dynamic language like Lua would have some way to know (say) the value of LUAL_BUFFERSIZE or some other constants defined in luaconf.h.

I realize that not all constants in there may be meaningful at runtime, but I think memory limits or whether the 'number' type is implemented as a double or a an int could really be useful. That could allow to write scripts that are more cross-platform or cross-implementation and implement at least some meaningful message to the user about why they cannot run in the current environment.

Couldn't some of those defines (or even some other parameters not found in luaconf.h, like max number of item that can be unpacked) be made available as "constants" in a table, or maybe through a function like the following:
debug.limits 'number-type'	--> 'double'
debug.limits 'number-size-bits'	--> 64
debug.limits 'buffersize-bytes'	--> 123456
debug.limits 'max-unpack-table-size' --> 8000

Am I missing something why Lua doesn't provide such informations? Isn't that so useful as I think?

On a related note (I remember this has been asked before, but it never got answered by Lua team) why the strange format of package.config content? It seems very unreadable. I suspect many people will parse package.config and assign the relevant characters to separate variables for readability and convenience. Wouldn't a table with keys like DIR_SEPARATOR or a function like package.config 'dir-separator' be more readable? Would that add so much more 'weight' to Lua?

Thanks

-- Lorenzo