V
V
VBKesha2015-06-27 23:25:58
Lua
VBKesha, 2015-06-27 23:25:58

Lua how to add data to a table so that it can be seen from C but not visible from Lua itself?

There was such, there is Lua and C code.
The C code creates a table and registers it as a global one, after which it attaches a metatable with the __index method to it, according to which, depending on the index, it returns other tables of the same type, also creating them in C.
I want to process data changes in these tables in C, I can also hang a metatable on them, but how can I understand by what index these tables were created? Is it possible somehow in Lua to attach data to the table that is visible only from C? Or maybe there is a better way to solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VBKesha, 2015-06-29
@VBKesha

I found myself on the function, you can hang a closure through lua_pushcclosure and already set what you need in them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question