Lua 5.3 support along with some compatibility adjustments. #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These items include uncompatible changes so you might like to create a new branch for them.
1. The undocumented API luaL_findtable
It is no longer available in Lua 5.3 but turned out practical for this project. We added an auxiliary function "lua_protobuf_find_or_create_nested_table" in lua-protobuf.h/cc with similar implementation. And all its references are replaced by the new function, of course.
2. luaL_register
It is also unavailable in Lua 5.3. We replaced it with the new API "luaL_setfuncs" for each call with a NULL "libname" param. And those with non-NULL "libname" params were replaced with a combination of "luaL_setfuncs" as well as "lua_protobuf_find_or_create_nested_table" mentioned in the first clause above, and maybe a "lua_pop", if necessary, instead.
3. lua_pushinteger for enums rather than lua_pushnumber
As the title says.
4. ternary conditional operator
Lua API lua_pushlstring and lua_pushnil have different return types, and gcc complains if we use them as the second and the third operand for the ternary conditional operator. We changed them to "if ... else ..." statements.