Update Lua to 5.4.4 (#7460)
* Update lua to 5.4.4 (fixes #7267) Signed-off-by: lawsonamzn <70027408+lawsonamzn@users.noreply.github.com>
This commit is contained in:
@@ -25,6 +25,11 @@ extern "C" {
|
||||
# include <Lua/lualib.h>
|
||||
# include <Lua/lauxlib.h>
|
||||
# include <Lua/lobject.h>
|
||||
|
||||
// versions of LUA before 5.3.x used to define a union that contained a double, a pointer, and a long
|
||||
// as L_Umaxalign. Newer versions define those inner types in the macro LUAI_MAXALIGN instead but
|
||||
// no longer actually declare a union around it. For backward compatibility we define the same one here
|
||||
union L_Umaxalign { LUAI_MAXALIGN; };
|
||||
}
|
||||
|
||||
#include <limits>
|
||||
@@ -1687,6 +1692,11 @@ LUA_API const Node* lua_getDummyNode()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char* ScriptDataContext::GetInterpreterVersion()
|
||||
{
|
||||
return LUA_VERSION;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ScriptContext*
|
||||
ScriptDataContext::GetScriptContext() const
|
||||
@@ -4367,7 +4377,7 @@ LUA_API const Node* lua_getDummyNode()
|
||||
lua_pushlightuserdata(m_lua, m_owner);
|
||||
int tableRef = luaL_ref(m_lua, LUA_REGISTRYINDEX);
|
||||
(void)tableRef;
|
||||
AZ_Assert(tableRef == AZ_LUA_SCRIPT_CONTEXT_REF, "Table referece should match %d !", AZ_LUA_SCRIPT_CONTEXT_REF);
|
||||
AZ_Assert(tableRef == AZ_LUA_SCRIPT_CONTEXT_REF, "Table reference should match %d but is instead %d!", AZ_LUA_SCRIPT_CONTEXT_REF, tableRef);
|
||||
|
||||
// create a AZGlobals table, we can use internal unodered_map if it's faster (TODO: test which is faster, or if there is a benefit keeping in la)
|
||||
lua_createtable(m_lua, 0, 1024); // pre allocate some values in the hash
|
||||
|
||||
@@ -212,6 +212,10 @@ namespace AZ
|
||||
|
||||
~ScriptDataContext() { Reset(); }
|
||||
|
||||
//! Retrieve a string representing the current version of the interpreter.
|
||||
//! Example of use: To signal incompatibility with previously emitted bytecode, to invalidate
|
||||
static const char* GetInterpreterVersion();
|
||||
|
||||
ScriptContext* GetScriptContext() const;
|
||||
lua_State* GetNativeContext() const { return m_nativeContext; }
|
||||
|
||||
|
||||
@@ -14,38 +14,13 @@ extern "C" {
|
||||
# include <Lua/lauxlib.h>
|
||||
}
|
||||
|
||||
// Currently we support Lua 5.1 and later (we have tested with 5.2)
|
||||
|
||||
#if LUA_VERSION_NUM <= 502
|
||||
|
||||
inline void lua_pushunsigned(lua_State* l, unsigned int v)
|
||||
{
|
||||
lua_pushnumber(l, static_cast<lua_Number>(v));
|
||||
}
|
||||
|
||||
inline unsigned int lua_tounsigned(lua_State* l, int idx)
|
||||
{
|
||||
return static_cast<unsigned int>(lua_tonumber(l, idx));
|
||||
}
|
||||
|
||||
#define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
|
||||
|
||||
inline LUA_API int lua_load(lua_State* L, lua_Reader reader, void* data, const char* chunkname, const char* mode)
|
||||
{
|
||||
(void)mode;
|
||||
return lua_load(L, reader, data, chunkname);
|
||||
}
|
||||
|
||||
#define LUA_RIDX_LAST 0
|
||||
#define LUA_NUMTAGS 9
|
||||
|
||||
#endif
|
||||
|
||||
#define AZ_LUA_SCRIPT_CONTEXT_REF LUA_RIDX_LAST + 1
|
||||
#define AZ_LUA_GLOBALS_TABLE_REF LUA_RIDX_LAST + 2
|
||||
#define AZ_LUA_CLASS_TABLE_REF LUA_RIDX_LAST + 3
|
||||
#define AZ_LUA_WEAK_CACHE_TABLE_REF LUA_RIDX_LAST + 4
|
||||
#define AZ_LUA_ERROR_HANDLER_FUN_REF LUA_RIDX_LAST + 5
|
||||
// Currently we support Lua 5.4.4 and later
|
||||
// note that Lua 5.x defines LUA_RID_LAST + 1 to be an index of a free-list.
|
||||
#define AZ_LUA_SCRIPT_CONTEXT_REF LUA_RIDX_LAST + 2
|
||||
#define AZ_LUA_GLOBALS_TABLE_REF LUA_RIDX_LAST + 3
|
||||
#define AZ_LUA_CLASS_TABLE_REF LUA_RIDX_LAST + 4
|
||||
#define AZ_LUA_WEAK_CACHE_TABLE_REF LUA_RIDX_LAST + 5
|
||||
#define AZ_LUA_ERROR_HANDLER_FUN_REF LUA_RIDX_LAST + 6
|
||||
|
||||
#define AZ_LUA_CLASS_METATABLE_NAME_INDEX 1 // can we always read the name from the behavior class???
|
||||
#define AZ_LUA_CLASS_METATABLE_BEHAVIOR_CLASS 2
|
||||
|
||||
Reference in New Issue
Block a user