lua-users home
lua-l archive

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

Am 09.06.2013 18:52 schröbte Philipp Kraus:

Am 09.06.2013 um 18:26 schrieb Pierre-Yves Gérardy:

On Sun, Jun 9, 2013 at 2:56 PM, Tim Hill <> wrote:
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.

On Jun 9, 2013, at 4:27 AM, Philipp Kraus <> wrote:
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

To complement Tim's answer, you'll be better off using a
`data:getElement(i, j, n)` method rather than successive
`__index(self, i)` calls, which would require some trickery.

Why is a getElement call bett than a __index call ?

__(new)index can only handle one dimension (without creating temporary objects) ...