[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Direct Memory Access to Lua variables?
- From: "b's spam" <spam@...>
- Date: Thu, 23 Jul 2009 14:00:56 -0400
I'm not too sure how to use the index/newindex metamethods for what I'm
trying to do. Are there examples of this somewhere?
[mailto:email@example.com] On Behalf Of Jerome Vuarand
Sent: Thursday, July 23, 2009 8:44 AM
To: Lua list
Subject: Re: Direct Memory Access to Lua variables?
2009/7/22 b's spam <firstname.lastname@example.org>:
> I'm writing a C++ wrapper class that allows me to manipulate variables in
> loaded lua script. It works fine, but is very slow because I'm performing
> these operations many times (in real-time). Is there a way to write
> to the memory location without having to search and push the variable onto
> the stack by name?
If you're doing a lot more C access than Lua access, you can store the
variable data in a userdata, that will never be moved (just store its
address in your C code). Then you can use index/newindex metamethods
to read or write that data from Lua.
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.392 / Virus Database: 270.13.23/2254 - Release Date: 07/23/09