Skip to content

Commit

Permalink
Lua writer: Fix Lua function/method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
minoki committed Sep 12, 2024
1 parent f46084d commit 9b0b0fc
Show file tree
Hide file tree
Showing 5 changed files with 245 additions and 632 deletions.
11 changes: 11 additions & 0 deletions lib/lunarml/mlinit-continuations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,24 @@ local table_pack = table.pack
--BEGIN table_unpack: table
local table_unpack = table.unpack
--END
--BEGIN table_unpackN: table_unpack
local function table_unpackN(t)
return table_unpack(t, 1, t.n)
end
--END

--BEGIN _id
local function _id(x)
return x
end
--END

--BEGIN _method
local function _method(obj, name, ...)
return obj[name](obj, ...)
end
--END

--BEGIN _exn_meta: string_format
local _exn_meta = {}
function _exn_meta:__tostring()
Expand Down
11 changes: 11 additions & 0 deletions lib/lunarml/mlinit-luajit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ local table_pack = table.pack or function(...) return { n = select("#", ...), ..
--BEGIN table_unpack: table
local table_unpack = table.unpack or unpack
--END
--BEGIN table_unpackN: table_unpack
local function table_unpackN(t)
return table_unpack(t, 1, t.n)
end
--END
--BEGIN tonumber
local tonumber = tonumber
--END
Expand Down Expand Up @@ -98,6 +103,12 @@ local function _id(x)
end
--END

--BEGIN _method
local function _method(obj, name, ...)
return obj[name](obj, ...)
end
--END

--BEGIN _exn_meta: string_format
local _exn_meta = {}
function _exn_meta:__tostring()
Expand Down
11 changes: 11 additions & 0 deletions lib/lunarml/mlinit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,24 @@ local table_pack = table.pack
--BEGIN table_unpack: table
local table_unpack = table.unpack
--END
--BEGIN table_unpackN: table_unpack
local function table_unpackN(t)
return table_unpack(t, 1, t.n)
end
--END

--BEGIN _id
local function _id(x)
return x
end
--END

--BEGIN _method
local function _method(obj, name, ...)
return obj[name](obj, ...)
end
--END

--BEGIN _exn_meta: string_format
local _exn_meta = {}
function _exn_meta:__tostring()
Expand Down
Loading

0 comments on commit 9b0b0fc

Please sign in to comment.