as part of my 11 year old daughters "stay at home" education for IT I was delighted when they were given a project in Lua, I quickly jumped on board and started coaching her in what Lua can do besides printing "Hello World" in a console, I grabbed the Lua 5.3 include that was posted here in the forums and began writing "Lessons", we now have the basic makings of a Lua driven game engine using PB's 2D commands exported to Lua and in my daughters mind she wrote it herself understanding every line of code which has been a fantastic bonding experience.
The next lesson I am writing (callback functions) makes use of C Lua functions that require the use of the LUA_REGISTRYINDEX pseudo-constant which is not defined in the Lua 5.3 pb include.
the definition trail is as such:
lua.h:
Code: Select all
#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000)Code: Select all
@@ LUAI_MAXSTACK limits the size of the Lua stack.
** CHANGE it if you need a different limit. This limit is arbitrary;
** its only purpose is to stop Lua from consuming unlimited stack
** space (and to reserve some numbers for pseudo-indices).
*/
#if LUAI_BITSINT >= 32
#define LUAI_MAXSTACK 1000000
#else
#define LUAI_MAXSTACK 15000
#endifCode: Select all
@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'.
*/
/* avoid undefined shifts */
#if ((INT_MAX >> 15) >> 15) >= 1
#define LUAI_BITSINT 32
#else
/* 'int' always must have at least 16 bits */
#define LUAI_BITSINT 16
#endifCode: Select all
#LUAI_BITSINT = 32
#LUAI_MAXSTACK = 1000000
#LUA_REGISTRYINDEX = -(#LUAI_MAXSTACK-1000)

