Re: Lua API for C++ code

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Lua API for C++ code

John Fletcher
> Date:          Tue, 18 Mar 1997 12:59:58 -0300
> Reply-to:      [hidden email]
> From:          Waldemar Celes <[hidden email]>
> To:            [hidden email]
> Subject:       Lua API for C++ code

> For those who are accessing Lua from C++ code,
> this may be of interest.
> 
> I have implemented a C++ API to access and manipulate Lua values.
> It consists of a header file (lua++.h) that defines a few classes
> that naturally bind Lua objects to C++ type and vice-versa.

I have implemented this under DOS using Microsoft Visual C++ version 
1.5.  I had the following problem with the example 

(in function change)

table["version"] = 1;

would not work (compiler said it was ambiguous) and had to be done as 

LuaValue temp(1);
table["version"] = temp;

I also suggest testing for the return value of Lua::dofile("name") 
which returns 2 if the file isn't found.

Cheers

John
---------------------------------------------------------------------
Dr John P. Fletcher          Tel: (44) 121 359 3611 ext 4625
Department of Chemical Engineering and Applied Chemistry (CEAC),
Aston University,            Fax: (44) 121 359 4094
Aston Triangle,              Email: [hidden email]
BIRMINGHAM B4 7ET  U.K.   
---------------------------------------------------------------------
CEAC Web site http://www.ceac.aston.ac.uk/
---------------------------------------------------------------------