[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Indices in Lua
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 19 Jun 2009 10:41:00 -0300
> Please allow me to pose the following suggestion to the developers of
> Lua 5.2.
> It concerns the parametrization of the type used for indexing.
> In the Lua Reference manual I find defined:
> typedef ptrdiff_t lua_Integer;
> typedef double lua_Number;
> However there is no corresponding typedef for indices. For example in
> "void lua_rawgeti (lua_State *L, int index, int n)" one find the int. It
> is also used to access the lua stack.
> I would plea for using a typedef here too. Especially because int is
> notouriously "vague" and its size can vary from system to system. It
> does not matter too much what representation is chosen, as long as it is
> adaptable in luaconf.h
lua_Integer and lua_Number are parameterised because they represent
user's values. The other 'ints' in the API are strongly related to the
internal implementation of Lua. To parameterise them would mean to
parameterise the entire source code. I think this would be a nightmare.