An open API service indexing awesome lists of open source software.

https://github.com/soniex2/lua-using

using() function for Lua.
https://github.com/soniex2/lua-using

Last synced: over 1 year ago
JSON representation

using() function for Lua.

Awesome Lists containing this project

README

          

# lua-using
using() function for Lua.

## Examples

Program:
```lua
local using = require"using".using

local mt = { __gc = print }

local function example()
using(setmetatable({}, mt), function(file, func)
error("the file should get cleaned up")
end)
end

xpcall(example, print)
print "did we cleanup? yes!"
```

Output:
```
table: 0xe5d010
./using.lua:11: example.lua:7: the file should get cleaned up
did we cleanup? yes!
```