[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Translate String of Variable Name into Variable Value
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Fri, 1 Jun 2007 11:30:13 -0400
spam@bitlet.com wrote:
> Here's a snippet of the relevant class declarations. The LUA script
> hooks
> into a compiled EXE/library that does the class-level processing.
> --
> C++ class clsid {
> const obj_document = 70;
> const obj_food = 72;
> const obj_pda = 50;
> };
>
>
> C++ class object {
> function item_in_slot(number) const;
> };
>
> --
> Right now, code like this works fine:
> return my_object:item_in_slot(1) == 72
>
> I'd like to be able to do something like:
> my_object:item_in_slot(1) == magically_get_value_of("obj_food")
This is not valid Lua code, so I assume that's C++. Unless you tell us
how you did the C++ to Lua binding I'm affraid that nobody can give you
any useful hint on how to implement your magical function. That's
because how to bind C++ classes to Lua is not defined in the Lua spec,
and there are many many ways to do it.