Skip to content

Commit b0d10d7

Browse files
committed
Fix compare two cdata in tarantool
1 parent 9b80cab commit b0d10d7

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Russian | [English](README_EN.md)</br>
55
Поддерживаются версии lua5.4 и luajit
66

77
## Pimp
8-
Модуль предназначен для красивой печати всех lua-типов, в особенности таблиц. А так же служит для простой отладки с использованием встроенной lua библиотеки debug.
8+
Модуль предназначен для красивой печати всех lua-типов, в особенности таблиц.</br>
9+
А так же служит для простой отладки с использованием встроенной lua библиотеки debug.</br>
910
Основная цель модуля — заменить print более совершенным инструментом.</br>
10-
<b>Создан вдохновившись icecream в python</b>
1111

1212
![Screenshot](https://github.com/uriid1/pimp-lua/blob/main/screenshots/screenshot.png)
1313

pimp/init.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,18 @@ local function findVarName(value, level)
5353
local i = 1
5454
while true do
5555
local name, val = getlocal(level, i)
56-
if not name then
56+
if name == nil then
5757
break
5858
end
5959

60-
if val == value then
60+
-- Fix: Compare two cdata in tarantool
61+
local _value = value
62+
if type(val) == 'cdata' then
63+
val = tostring(val)
64+
_value = tostring(value)
65+
end
66+
67+
if val == _value then
6168
table.insert(stack, name)
6269
end
6370

0 commit comments

Comments
 (0)