Skip to content

Commit

Permalink
Made {{ a thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamharrison committed Apr 21, 2024
1 parent d292968 commit a202d2a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lpm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2447,8 +2447,9 @@ not commonly used publically.
if arg:sub(offset, offset) == "{" then
s,e = arg:find("%b{}", offset)
if not e then error(string.format("no end to chunk %s", arg:sub(offset))) end
local chunk = arg:sub(s + 1, e - 1)
local func, err = load("local addon = ... return " .. chunk)
local amount = arg:sub(offset+1, offset+1) == "{" and 2 or 1
local chunk = arg:sub(s + amount, e - amount)
local func, err = load("local addon = ... " .. (amount == 2 and "return" or "") .. " " .. chunk)
if err then error(string.format("can't parse chunk %s: %s", chunk, err)) end
result[i] = func
offset = e + 1
Expand Down

0 comments on commit a202d2a

Please sign in to comment.