Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added luajit support #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
11 changes: 6 additions & 5 deletions repl/plugins/pretty_print.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,19 @@ local type_order = {
number = 0,
string = 1,
userdata = 2,
table = 3,
thread = 4,
boolean = 5,
['function'] = 6,
cdata = 3,
table = 4,
thread = 5,
boolean = 6,
['function'] = 7,
}

local function cross_type_order(a, b)
local pos_a = type_order[ type(a) ]
local pos_b = type_order[ type(b) ]

if pos_a == pos_b then
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't working in luajit for me.

$ luajit
> r = require'repl.console'
> r:loadplugin'pretty_print'
> r:run()
> f = {}
> f[pairs] = 23
> f[ipairs] = 42
> return f
/usr/local/share/lua/5.1/repl/plugins/pretty_print.lua:114: attempt to compare two function values

return a < b
return tostring(a) < tostring(b)
else
return pos_a < pos_b
end
Expand Down