lua-users home
lua-l archive

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



Why not the contrary, giving "lua.hpp" et.al.

with something like:
	#define COMPILE_LUA_AS_TRUE_CPLUSPLUS	// ;)
	#include <lua.h>

The newbies won't use "clua.h", it just makes more confusion.
But the difference of ".hpp" and ".h" should be obvious.



Wim Couwenberg kirjoittaa perjantaina, 13. kesäkuuta 2003, kello 10:14:

People have just
become used to that code appearing in C libraries and I'm sure a lot
don't even know what extern "C" does or why it's there.

I think a sensible alternative pops up in each thread on
this issue as well.  Don't use the C lua headers, but use
C++ counterparts instead.  Suggestion: distribute files
clua.h, clauxlib.h and clualib.h (in the ./include dir)
and mention them in the manual, where each file simply wraps
the C header:

in clua.h:

extern "C" {
#include <lua.h>
}

etc.  (An #ifndef guard is not strictly necessary, but may be
nicer?)

Now you can do:

#include <clua>

etc. in your C++ code (no suffix).

This is the C++ convention to use C standard headers so why not
use it for Lua?  (lua.h will become a standard header right?
;-))  You still need to read the manual though...

Bye,
Wim