Skip to content

Commit

Permalink
fix: loadstring for 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pgagnidze committed Jul 31, 2023
1 parent e719769 commit c5e661c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ena/helper/common.lua
@@ -1,4 +1,3 @@
---@diagnostic disable: duplicate-set-field
local common = {}
local lpeg = require "lpeg"
local literals = require "ena.lang.literals"
Expand All @@ -9,6 +8,7 @@ local V = lpeg.V
common.endToken = V "endToken"

if not table.pack then
---@diagnostic disable: duplicate-set-field
function common.tablePack(...)
return { n = select('#', ...), ... }
end
Expand Down
4 changes: 3 additions & 1 deletion ena/parser.lua
Expand Up @@ -156,7 +156,9 @@ local function node(tag, ...)
local params = table.concat(labels, ", ")
local fields = string.gsub(params, "(%w+)", "%1 = %1")
local code = string.format("return function (%s) return {tag = '%s', %s} end", params, tag, fields)
return assert(load(code))()
---@diagnostic disable-next-line: deprecated
local loadFunc = loadstring or load
return assert(loadFunc(code))()
end

local nodeVariable = node("variable", "value")
Expand Down

0 comments on commit c5e661c

Please sign in to comment.