lua-users home
lua-l archive

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


Qualified yes, depending on what you mean by "directly".

Lua cannot access userdata items directly (that is by design, its not supposed to!). However, you can write your own C/C++ functions and wire them into Lua, then call these functions from Lua, passing the userdata.

--Tim

On Jun 9, 2013, at 4:27 AM, Philipp Kraus <philipp.kraus@flashpixx.de> wrote:

> Hello,
> 
> I have got multidimensional cubes in C++ and would like to push them into LUA. I would like to create a structure in LUA like
> data[i][j][n] = 123
> 
> The data can be any type (most numerical types). Also I have got std::maps with strings and cubes eg std::map <std::string, cube<doube,3> >
> Is there a solution to get access to the data in LUA without copying? I would like to modify the data from the LUA script direct in the memory,
> because the datablocks are very large.
> 
> I have found the user-defined type (pointer to my memory), but I have tested it with array (std::vector) only, so in my case I have complex data
> structures, eg I would like to modify my std::map direct from LUA.
> 
> Hope for some ideas :-)
> Thanks
> 
> Phil
> 
>