lua-users home
lua-l archive

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


Asko Kauppi wrote:

2 layers is a must :) but how about three, or more?

The first one (in C) is a plain C/Lua API (doing some table stuff etc. but mostly following the C API). This is just a lot of work, and rather unusable (or, you could be coding in C just the same..)

The second one (in Lua) is an object oriented one, tying the bits and pieces together into a more realistic framework. This is probably "how the GTK+ object system was meant to be" kind-of level.

The third one (and on..) will be helper functions for this and that, such as gathering menus and box layouts by simple tables, instead of doing them part by part.


I see one possible major problem with a simple implemetation of the
level one API. Does it enable crashing the application?

I mean something like:

button = create_button("Hello");
destroy_button(button);
set_label(button,"Don't do this");

Avoiding this can add quite a lot of code to the level 1
implementation, especially if the C level libary isn't
helping.

Of course if the level 1 API is hidden from the application programmer,
and only used in implementing the real, higher level, API then everything is fine.

This occured to me when I considered adding Lua into a plugin
enabled (closed source) CAD application, and I noticed that
making the Lua API crash proof was not going to be trivial.


	Eero