summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/C/lua_pushinteger.c2
-rw-r--r--tests/lapi.js14
2 files changed, 8 insertions, 8 deletions
diff --git a/tests/C/lua_pushinteger.c b/tests/C/lua_pushinteger.c
index 0c9a49f..da134b6 100644
--- a/tests/C/lua_pushinteger.c
+++ b/tests/C/lua_pushinteger.c
@@ -12,7 +12,7 @@ int main(void) {
lua_pushinteger(L, 10);
- printf("L->top(%d): %s\n", lua_gettop(L), luaL_typename(L, lua_gettop(L)));
+ printf("L->top(%d): type %s, value %ld\n", lua_gettop(L), luaL_typename(L, lua_gettop(L)), lua_tointeger(L, -1));
lua_close(L);
diff --git a/tests/lapi.js b/tests/lapi.js
index 8dd2680..875a89c 100644
--- a/tests/lapi.js
+++ b/tests/lapi.js
@@ -65,7 +65,7 @@ test('lua_pushnumber', function (t) {
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L)].value,
+ lapi.lua_tonumber(L, -1),
10.5,
"top is correct"
);
@@ -81,7 +81,7 @@ test('lua_pushinteger', function (t) {
L = lauxlib.luaL_newstate();
- lapi.lua_pushnumber(L, 10);
+ lapi.lua_pushinteger(L, 10);
}, "JS Lua program ran without error");
@@ -98,7 +98,7 @@ test('lua_pushinteger', function (t) {
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L)].value,
+ lapi.lua_tointeger(L, -1),
10,
"top is correct"
);
@@ -131,7 +131,7 @@ test('lua_pushstring', function (t) {
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L)].value,
+ lapi.lua_tostring(L, -1),
"hello",
"top is correct"
);
@@ -164,7 +164,7 @@ test('lua_pushboolean', function (t) {
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L)].value,
+ lapi.lua_toboolean(L, -1),
true,
"top is correct"
);
@@ -205,13 +205,13 @@ test('lua_pushvalue', function (t) {
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L)].value,
+ lapi.lua_tostring(L, -1),
"hello",
"top is correct"
);
t.strictEqual(
- L.stack[lapi.lua_gettop(L) - 1].value,
+ lapi.lua_tostring(L, -2),
"hello",
"top is correct"
);