lua-protobuf icon indicating copy to clipboard operation
lua-protobuf copied to clipboard

Lua 5.3 support along with some compatibility adjustments.

Open admbbs opened this issue 5 years ago • 0 comments

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.

admbbs avatar Apr 09 '20 10:04 admbbs