7
Working with C++ Types
In the previous chapter, we learned how to call C++ code from Lua and how to register C++ modules. You might have observed that you can create objects in C++ and register them to Lua, but how about creating C++ objects freely in Lua? This is what we will set out to achieve in this chapter.
We will learn about the following topics and export C++ types to Lua in a top-down approach:
- How to use the Lua registry
- How to use userdata
- Exporting C++ type to Lua
Technical requirements
Here are the technical requirements for this chapter:
- You can access the source code for this chapter at https://github.com/PacktPublishing/Integrate-Lua-with-CPP/tree/main/Chapter07.
- The previous chapter showed you how to register C++ modules; ...
Get Integrate Lua with C++ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.