Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

support Lua 5.3 #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Luabins authors:
----------------

Alexander Gladysh <[email protected]>
hanxi <[email protected]>
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ ifeq ($(shell uname),Darwin)
LUALIB := lua
else
# Assuming Ubuntu
LUA_LIBDIR := /usr/lib
LUA_INCDIR := /usr/include/lua5.1
LUALIB := lua5.1
LUA_LIBDIR := /home/hlm/tmp/lua-5.3.1/src
LUA_INCDIR := /home/hlm/tmp/lua-5.3.1/src
LUALIB := lua
endif

PROJECTNAME := luabins
Expand Down
2 changes: 1 addition & 1 deletion src/luabins.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static int l_load(lua_State * L)
}

/* luabins Lua module API */
static const struct luaL_reg R[] =
static const struct luaL_Reg R[] =
{
{ "save", l_save },
{ "load", l_load },
Expand Down
10 changes: 10 additions & 0 deletions src/luaheaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ extern "C" {

#include <lua.h>
#include <lauxlib.h>

#if !defined LUA_VERSION_NUM
#define luaL_Reg luaL_reg
#endif

#if LUA_VERSION_NUM > 501
#define luaL_register(L,n,R) (luaL_newlib(L,R))
#define lua_objlen(L,i) lua_rawlen(L, (i))
#endif

#if defined (__cplusplus) && !defined (LUABINS_LUABUILTASCPP)
}
#endif
Expand Down
5 changes: 4 additions & 1 deletion test/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

package.cpath = "./?.so;"..package.cpath

local pack = pack or table.pack
local unpack = unpack or table.unpack
local randomseed = 1235134892
--local randomseed = os.time()

Expand Down Expand Up @@ -145,6 +147,7 @@ end
-- Test helper functions
-- ----------------------------------------------------------------------------

luabins = require 'luabins'
local luabins_local = require 'luabins'
assert(luabins_local == luabins)

Expand Down Expand Up @@ -281,7 +284,7 @@ check_fail_save(
"can't save: unsupported type detected",
coroutine.create(function() end)
)
check_fail_save("can't save: unsupported type detected", newproxy())
check_fail_save("can't save: unsupported type detected", function()end)

print("---> basic table tests")

Expand Down