Closed pozemka closed 7 months ago
This could be addressed with many solutions (all of them require some kind of extra effort), here are 2 approaches:
1- Serialization/Deserialization: You could write a serialization/deserialization factory which handle how C++
structs are read from Lua
table, written to Lua
table. This will be the cleanest by far.
2- Use a runtime reflection library to register your needed C++
types and then use the reflection data to serialize/deserialize C++
/Lua
.
So basically yes, it is out of sol2
scope.
Hello! I am loading Lua table to C++ structure and want to do the opposite — save it to .lua file. For example, my lua file is
In C++ I am doing this:
I there a simple way to save my
Level
structure as Lua code. Perhaps with some limitations but without writing Lua codegen?Something like this:
Or this is out of sol2 scope?