lua_getdefault() is used when you need to return some null value for a variable. For numbers it will be okay to return 0, but for std::string we have to return “null”, for example. (You can add another cases for different types)
That’s why we add template specialization.(it goes in LuaScript.h)

Now we’ll implement template get function(this will all go in LuaScript.h file)

The algorigthm for lua_gettostack is simple . Suppose you have a variable you want to get, for example named player.pos.X.

player table is global, so you need to get it via lua_getglobal method. Now player table will be on the top of your stack and you will use lua_getfield function to get pos table and then variable x. We use level variable to know which level we’re currently on and how many items are currently in stack

There is an bug with the formatting. Rather than having the “Greater than” and “Less than” signs displayed, “&>” is displayed for the “Greater than” sign and “&<” is displayed for the “Less than” sign. It is fine on the source code on GitHub so it isn’t an issue on my end. I have seen a few website like this recently. Not all websites though. Just a few of them. Anyhow, you should check out that freaky bug…

yeah it’s super annoying. I complained to wordpress devs about this stuff. I think they have since fixed some bugs in encoding, but it still has problem.
These days I usually write my blog posts in a gist and copy/paste the generated HTML into WordPress, or write the post in a plain .txt file in OneDrive. Basically, I avoid WordPress’ actual editor.