lua-users home
lua-l archive

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


tolua already provides tags to be included in the .h file.
it is an undocumented feature :-(

you can include tags, in comments, in the real .h file.
there are three types of tags (case insensitive).

block tags:
/* tolua_begin */

            <-- code to be parsed by tolua

/* tolua_end */

or line tag:

<code to be parsed by tolua>       /* tolua_export */

the .pkg still have to exist, but it can have directives to include tagged header files as in:

${header.h}

as an example, consider:

real header file: example.h

--------------------------------
#include "something.h"

#define    N   100            // tolua_export

// tolua_begin
class T {
 T ();
 ~T();
};

// tolua_end
---------------------------


.pkg file: example.pkg
----------------------
${example.h}
---------------------

-- celes


At 12:51 26/11/2002 +0100, you wrote:
> * Do you use tolua? If not, do you use any other wrapper?
yes
> * Do you use tolua for C or C++?
C++

> * What features do you miss in tolua?
> * How could tolua be improved?

i prefer to keep everything in the .hpp files rather than having to maintain
extra package-files.
i extended tolua to help with this. namely, i added to the existing
TOLUA_BEGIN / TOLUA_END a mechanism to register (parts of) classes:
TOLUA_CLASS(ClassName) / TOLUA_END

it works like this:

class ClassName : public BaseClass
{
        // stuff i don't want to expose to lua
        void InternalFunction();

public:
        // now comes the "lua interface" of the class
        // TOLUA_CLASS(ClassName:BaseClass)
        void ExposedFunction();
        // TOLUA_END
}

i also made some patches to let tolua understand some more standard C++
constructs (such as enums with trailing commas)
basically i'd wish that tolua would just understand any C++ construct that
is valid in C++.

Cheers,
Peter