Skip to content

mah0x211/lua-gcfn

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

lua-gcfn

test codecov

gcfn create the finalizer object.

Installation

luarocks install gcfn

Usage

local gcfn = require('gcfn')

-- create new gcfn object
local gco = gcfn(function(...)
    print(...)
end, 'a', 'b', 'c' )

gco = nil
collectgarbage('collect')
print('done')

gco = gcfn( fn [, ...] )

create a new gc fucntion object.

Parameters

  • fn:function: a function to execute when GC occurs.
  • ...: : arguments of function

Returns

  • gco:gcfn: gcfn object.

gco:disable()

disable the invocation of GC function.

gco:enable()

enable the invocation of GC function.

gco:errfunc( fn, ... )

sets the error function to be called when the GC function fails.

Parameters

  • fn:function: a function.
  • ...: : arguments of function.

NOTE

The error object err is passed afterthe the arguments ....

About

create gc function for lua

Resources

License

Stars

Watchers

Forks

Packages

No packages published