Skip to content
Snippets Groups Projects
  • Vladislav Shpilevoy's avatar
    ed217292
    error: export error_unref() function · ed217292
    Vladislav Shpilevoy authored
    C struct error objects can be created directly only in C.
    C-side increments their reference counter when pushes to the Lua
    stack.
    
    It is not going to be so convenient soon. error_unpack() function
    will be used in netbox to decode error object via Lua FFI.
    
    Such error object will have 0 refs and no Lua GC callback
    established. Because it won't be pushed on Lua stack natually,
    from Lua C. To make such errors alive their reference counter
    will be incremented and error_unref() will be set as GC callback.
    
    Follow up for #4398
    ed217292
    History
    error: export error_unref() function
    Vladislav Shpilevoy authored
    C struct error objects can be created directly only in C.
    C-side increments their reference counter when pushes to the Lua
    stack.
    
    It is not going to be so convenient soon. error_unpack() function
    will be used in netbox to decode error object via Lua FFI.
    
    Such error object will have 0 refs and no Lua GC callback
    established. Because it won't be pushed on Lua stack natually,
    from Lua C. To make such errors alive their reference counter
    will be incremented and error_unref() will be set as GC callback.
    
    Follow up for #4398