lua-users home
lua-l archive

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


On Wed, Jul 22, 2009 at 6:15 PM, b's spam<spam@inlandstudios.com> wrote:
> I'm writing a C++ wrapper class that allows me to manipulate variables in a
> 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 directly
> to the memory location without having to search and push the variable onto
> the stack by name?

Unfortunately I think the immediate answer is no, you can't get a
trustworthy memory location.

If you're interested, what I'd recommend trying instead is storing the
values on the C++ side, with "getter" and "setter" functions for them
present in the Lua universe. Once you have these you can also try
using them inside __index and __newindex metamethods on a
table/userdata so that it feels more seamless (although you will
probably lose some performance again in doing that).

-Duncan