lua-users home
lua-l archive

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


> Date:          Tue, 18 Mar 1997 12:59:58 -0300
> Reply-to:      lua-l@tecgraf.puc-rio.br
> From:          Waldemar Celes <celes@graphics.cornell.edu>
> To:            j.p.fletcher@aston.ac.uk
> 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: J.P.Fletcher@ASTON.AC.UK
BIRMINGHAM B4 7ET  U.K.   
---------------------------------------------------------------------
CEAC Web site http://www.ceac.aston.ac.uk/
---------------------------------------------------------------------