lua-users home
lua-l archive

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


I'm going through the Lua object types code to see if there's
a more or less painless way to make write only objects.

I've noted that in lobject.h there are two definitions
for the tt field:

#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked

#define TValuefields Value value; int tt

So this raises a couple of questions:

1. The number of object type enums is around 8 right now, with
   LUA_TNONE as -1. Should the tt actually be a signed char
   in order to save some space?

2. Should the two tt definitions be consistent?

3. What thought has been given to making some Lua objects
   read-only (and thus forcing them to be non-collectable)

I'm thinking of this in the context of Lua tables, strings, etc
in ROM to save RAM space in memory constrained systems.

It will also require a way to "lay down" table node definitions
ar compile time rather than run time.

It might also mean forcing the hash function for read only
tables or strings to return the head of a single search list
which will slow down read only table access.

I know Bogdan has been thinking along the same lines with his
eLua project and I'm just investigating alternatives that can be
extended to stock Lua without writing custom handlers for
each data type...

Ralph