You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lua 5.4 added support for using <close> on a variable to allow calling a destructor function as soon as it goes out of scope. I think that this feature could also be made to work with target versions below 5.4.
Let's assume we have this Yuescript code:
do
close db_connection ={<close>:=>@disconnect()}-- do stuff...
It could compile to something like this:
dolocaldb_connection=setmetatable({}, { __close=function(self) self:disconnect() end })
local_close_0=assert(getmetatable(db_connection).__close)
local_err_0=falselocal_msg_0xpcall(function()
-- do stuff...end, function(err)
_err_0=true_msg_0=errend)
_close_0(db_connection)
if_err_0thenerror(_msg_0)
endend
Also, I'd just like to say: Thank you for taking your time to address most of my issues and for being so responsive.
The text was updated successfully, but these errors were encountered:
Sorry for being late this time. It took me some effort trying out your good idea. And I made some modification according to the way that the variadic items can be handled, mentioned in issue #144.
Lua 5.4 added support for using
<close>
on a variable to allow calling a destructor function as soon as it goes out of scope. I think that this feature could also be made to work with target versions below 5.4.Let's assume we have this Yuescript code:
It could compile to something like this:
Also, I'd just like to say: Thank you for taking your time to address most of my issues and for being so responsive.
The text was updated successfully, but these errors were encountered: