[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Lua API for C++ code
- From: Grant Munsey <grant@...>
- Date: Tue, 18 Mar 1997 08:13:14 -0800
Has there been any discussion of changing the Lua float type from float
to double? I did this on my own so that you could go from float type to int
type without losing data.
-----Original Message-----
From: Waldemar Celes [SMTP:celes@graphics.cornell.edu]
Sent: Tuesday, March 18, 1997 8:00 AM
To: grant@cognicon.com
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.
For instance, if we have the following Lua code:
myTable = {name = "lua++"}
It is valid to write a C++ code like this one:
...
LuaObject t = Lua:getglobal("myTable"); // access the table object
LuaObject f = Lua:getglobal("print"); // access the pre-defined function
f(t["name"]); // call Lua function
...
which will output the string "lua++".
Also, if we have a Lua function:
function myFunc (a,b)
print(a+b)
end
We can call it from C++ code doing:
...
LuaObject f = Lua:getglobal("myFunc");
f(5,7);
...
It is still a beta version, but if you want to try it
and help me to improve it, the code and a naive documentation
can be reached at:
http://www.graphics.cornell.edu/~celes/lua++/lua++.html
Waldemar
--------------
Waldemar Celes
Program of Computer Graphics
Cornell University
580 Engineering Theory Center Building
Ithaca, NY -- 14853
e-mail: celes@graphics.cornell.edu
home page: http://www.graphics.cornell.edu/~celes/
<<application/ms-tnef>>