Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
 Integrate Lua with C++

You're reading from   Integrate Lua with C++ Seamlessly integrate Lua scripting to enhance application flexibility

Arrow left icon
Product type Paperback
Published in Oct 2023
Publisher
ISBN-13 9781805128618
Length 216 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Wenhuan Li Wenhuan Li
Author Profile Icon Wenhuan Li
Wenhuan Li
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Part 1 – Lua Basics FREE CHAPTER
2. Chapter 1: Getting Your C++ Project Lua-Ready 3. Chapter 2: Lua Fundamentals 4. Part 2 – Calling Lua from C++
5. Chapter 3: How to Call Lua from C++ 6. Chapter 4: Mapping Lua Types to C++ 7. Chapter 5: Working with Lua Tables 8. Part 3 – Calling C++ from Lua
9. Chapter 6: How to Call C++ from Lua 10. Chapter 7: Working with C++ Types 11. Chapter 8: Abstracting a C++ Type Exporter 12. Part 4 – Advanced Topics
13. Chapter 9: Recapping Lua-C++ Communication Mechanisms 14. Chapter 10: Managing Resources 15. Chapter 11: Multithreading with Lua 16. Index 17. Other Books You May Enjoy

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, folder names, filenames, file extensions, pathnames, user input and program output.

Here is an example: “Then you create a union type with std::variant, saying that this union type may be and can only be from the pre-defined Lua mappings.”

A block of code is set as follows:

void LuaExecutor::setRegistry(const LuaValue &key,
                              const LuaValue &value)
{
    pushValue(key);
    pushValue(value);
    lua_settable(L, LUA_REGISTRYINDEX);
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

int luaNew(lua_State *L)
{
    ....
    if (type == LUA_TNIL)
    {
        ...
        lua_pushcfunction(L, luaDelete);
        lua_setfield(L, -2, "__gc");
    }
    ...
}

Bold: Indicates a new term, an important concept, or crucial software. Here is an example: “All systems with graphic user interfaces will also provide an application in which to start a shell. Often, those applications are called a terminal or a console.”

Tips or important notes

Appear like this.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image