Open DarkMarmot opened 1 year ago
I verified that this behavior is still in the develop
branch as well.
Yes, this is due to a change in the internals of the Luerl state. In the old state the Lua functions would be directly kept everywhere they were referenced which meant that there could be many copies of a function. Now the functions are kept in a table in the state and referenced through that table using the funref
data which means that there is only one copy of each function.
I found that my code no longer worked with the 1.0 version here, but works fine with 0.4.
To reproduce (in Elixir, apologies) in 1.0:
iex(1)> {_, chunk, _} = :luerl.load("return 2 + 5", :luerl.init())
In version 0.4, chunk would be:
{:lua_func, 1, 0, [], 1, [{:push_lit, 2.0}, {:push_lit, 5.0}, {:op, :+, 2}, :multiple, {:return, 1}]}
But in 1.0, it's now:
{:funref, 0, []}
Thanks for the library, I've much enjoyed it!