Small suggestions for luaL_Buffers & their documentation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Small suggestions for luaL_Buffers & their documentation

frank@kastenholz.org
The manual does not say how to release the space occupied by a luaL_Buiffer.  Presumably luaL_pushresult() will reclaim resources.  The manual does not say how to handle errors.  Looking through mailing lists/etc, it looks like simply returning from the function in which the buffer was created will reclaim resources … but the manual does not say so..

Second, is there an “approved”  way to determine the current size of a liuaL_Buffer.  I see that there is a field, n, in the structure that is the :”number of characters in the buffer”. Is this field guaranteed to always be there? (If so, can it be documented?). If not, can a function be added to retrieve the current size?  I have a use are where I need to ensure that the string does not grow “too big” - so I’d like to be able to find the current length in a manner that is formally part of the API.  (Alternatively, a way to limit the buffer’s maximum size would be ok - except then all the functions that add values to the buffer need to return a status… this seems to break the existing api/etc.

thanks
frank kastenholz


-