rrthomas / lrexlib

A Lua (5.1 and later) binding of various regex library APIs (POSIX, PCRE, PCRE2, GNU, Oniguruma and TRE)
Other
161 stars 29 forks source link

Lua 5.2+ attempt to call a nil value (upvalue 'loadstring') #38

Closed Quronox closed 3 years ago

Quronox commented 3 years ago

Hey there. The Bug is quite easy:

jsonschema.lua line 261:

local loader, err = loadstring(tab_concat(self._code_table, ""), 'jsonschema:' .. (name or 'anonymous'))

On my system with Lua 5.4 that line gives this error: attempt to call a nil value (upvalue 'loadstring')

it works when I call it like this:

local loader, err = load(tab_concat(self._code_table, ""), 'jsonschema:' .. (name or 'anonymous'))

some solution would probably be:

local loadfkt = loadstring or load local loader, err = loadfkt(tab_concat(self._code_table, ""), 'jsonschema:' .. (name or 'anonymous'))

Quronox commented 3 years ago

ahh fk sorry, wrong repo