Skip to content

Commit e0f0b4d

Browse files
committed
Adds support for Lua 5.3
- Rewrote the Travis-ci integration - Dropped lunit since it does not support Lua 5.3, started using lunitx.
1 parent b1592cd commit e0f0b4d

File tree

7 files changed

+78
-23
lines changed

7 files changed

+78
-23
lines changed

.travis.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,19 @@ language: erlang
22

33
env:
44
global:
5-
- LUAROCKS_BASE=luarocks-2.1.1
5+
- LUAROCKS_BASE=luarocks-2.2.0
66
matrix:
77
- LUA=lua5.1 LUA_DEV=liblua5.1-dev LUA_VER=5.1 LUA_SFX=5.1 LUA_INCDIR=/usr/include/lua5.1
88
- LUA=lua5.2 LUA_DEV=liblua5.2-dev LUA_VER=5.2 LUA_SFX=5.2 LUA_INCDIR=/usr/include/lua5.2
9+
- LUA=lua5.3 LUA_DEV=liblua5.3-dev LUA_VER=5.3 LUA_SFX= LUA_INCDIR=/usr/local/include
910
- LUA=luajit LUA_DEV=libluajit-5.1-dev LUA_VER=5.1 LUA_SFX=jit LUA_INCDIR=/usr/include/luajit-2.0 LUAJIT_VER=2.0
1011
- LUA=luajit LUA_DEV=libluajit-5.1-dev LUA_VER=5.1 LUA_SFX=jit LUA_INCDIR=/usr/include/luajit-2.1 LUAJIT_VER=2.1
1112

1213
before_install:
13-
- if [ $LUA = "luajit" ] && [ $LUAJIT_VER = "2.0" ]; then
14-
sudo add-apt-repository ppa:mwild1/ppa -y && sudo apt-get update -y;
15-
fi
16-
- if [ $LUA = "luajit" ] && [ $LUAJIT_VER = "2.1" ]; then
17-
sudo add-apt-repository ppa:neomantra/luajit-v2.1 -y && sudo apt-get update -y;
18-
fi
19-
- sudo apt-get install $LUA
20-
- sudo apt-get install $LUA_DEV
21-
- lua$LUA_SFX -v
22-
# Install a recent luarocks release
23-
- wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz
24-
- tar zxvpf $LUAROCKS_BASE.tar.gz
25-
- cd $LUAROCKS_BASE
26-
- ./configure
27-
--lua-version=$LUA_VER --lua-suffix=$LUA_SFX --with-lua-include="$LUA_INCDIR"
28-
- make build && sudo make install
29-
- cd $TRAVIS_BUILD_DIR
14+
- travis/before_install.sh;
3015

3116
install:
32-
- sudo luarocks install lunit
17+
- sudo luarocks install lunitx
3318

3419
script:
3520
- cd unittest

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/ignacio/StackTracePlus.png?branch=master)](https://travis-ci.org/ignacio/StackTracePlus)
44

5-
StackTracePlus provides enhanced stack traces for [Lua 5.1, Lua 5.2][1] and [LuaJIT][2].
5+
StackTracePlus provides enhanced stack traces for [Lua 5.1, Lua 5.2, Lua 5.3][1] and [LuaJIT][2].
66

77
StackTracePlus can be used as a replacement for debug.traceback. It gives detailed information about locals, tries to guess
88
function names when they're not available, etc, so, instead of
@@ -35,7 +35,7 @@ you'll get
3535
## Usage #
3636

3737
StackTracePlus can be used as a replacement for `debug.traceback`, as an `xpcall` error handler or even from C code. Note that
38-
only the Lua 5.1 interpreter allows the traceback function to be replaced "on the fly". LuaJIT and Lua 5.2 always calls luaL_traceback internally so there is no easy way to override that.
38+
only the Lua 5.1 interpreter allows the traceback function to be replaced "on the fly". LuaJIT, Lua 5.2 and 5.3 always calls luaL_traceback internally so there is no easy way to override that.
3939

4040
```lua
4141
local STP = require "StackTracePlus"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package = "StackTracePlus"
2+
version = "0.1.2-1"
3+
source = {
4+
url = "https://github.com/ignacio/StackTracePlus/archive/0.1.2-1.tar.gz",
5+
dir = "StackTracePlus-0.1.2-1"
6+
}
7+
description = {
8+
summary = "StackTracePlus provides enhanced stack traces for Lua",
9+
detailed = [[
10+
StackTracePlus can be used as a replacement for debug.traceback. It gives detailed information about locals, tries to guess
11+
function names when they're not available, etc.
12+
]],
13+
license = "MIT/X11",
14+
homepage = "http://github.com/ignacio/StackTracePlus"
15+
}
16+
17+
dependencies = { "lua >= 5.1, < 5.4" }
18+
19+
build = {
20+
type = "builtin",
21+
modules = {
22+
StackTracePlus = "src/StackTracePlus.lua"
23+
}
24+
}

src/StackTracePlus.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ add_known_module("bit32", "bit32 module")
4242
-- luajit
4343
add_known_module("bit", "bit module")
4444
add_known_module("jit", "jit module")
45+
-- lua5.3
46+
if _VERSION >= "Lua 5.3" then
47+
add_known_module("utf8", "utf8 module")
48+
end
4549

4650

4751
local m_user_known_tables = {}

travis/before_install.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash -e
2+
3+
if [ $LUA = "luajit" ]; then
4+
if [ $LUAJIT_VER = "2.0" ]; then
5+
sudo add-apt-repository ppa:mwild1/ppa -y && sudo apt-get update -y;
6+
fi
7+
if [ $LUAJIT_VER = "2.1" ]; then
8+
sudo add-apt-repository ppa:neomantra/luajit-v2.1 -y && sudo apt-get update -y;
9+
fi
10+
fi
11+
12+
if [[ $LUA = "lua5.3" ]]; then
13+
LUA_V="5.3.0"
14+
wget "http://www.lua.org/ftp/lua-${LUA_V}.tar.gz"
15+
tar xf "lua-${LUA_V}.tar.gz"
16+
pushd "lua-${LUA_V}"
17+
make linux
18+
sudo make install
19+
popd
20+
else
21+
sudo apt-get install $LUA
22+
sudo apt-get install $LUA_DEV
23+
fi
24+
lua$LUA_SFX -v
25+
# Install a recent luarocks release
26+
wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz
27+
tar zxvpf $LUAROCKS_BASE.tar.gz
28+
pushd $LUAROCKS_BASE
29+
# esto quedo medio feo
30+
if [[ $LUA = "lua5.3" ]]; then
31+
./configure --lua-version=$LUA_VER --with-lua-include="$LUA_INCDIR"
32+
else
33+
./configure --lua-version=$LUA_VER --lua-suffix=$LUA_SFX --with-lua-include="$LUA_INCDIR"
34+
fi
35+
make build && sudo make install
36+
popd
37+
cd $TRAVIS_BUILD_DIR

unittest/run.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local lunit = require "lunit"
1+
local lunit = require "lunitx"
22

33
package.path = "../src/?.lua;../src/?/init.lua;".. package.path
44

unittest/test.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
local STP = require "StackTracePlus"
2+
local lunit = require "lunitx"
23

3-
module(..., lunit.testcase, package.seeall)
4+
if _VERSION >= "Lua 5.2" then
5+
_ENV = lunit.module("simple","seeall")
6+
else
7+
module( ..., package.seeall, lunit.testcase )
8+
end
49

510
function testLuaModule()
611
local f = function()

0 commit comments

Comments
 (0)