commit 19a96d85bc867026e578597defc19dfcef936f63 from: ligurio date: Sat Nov 18 18:17:52 2023 UTC Deploying to gh-pages from @ ligurio/lua-c-manual-pages@9525c1398be1ae3dd364991da415208c2c7d73a6 🚀 commit - b126871012fbb9a9f2c86c662ea93e802f4e3e29 commit + 19a96d85bc867026e578597defc19dfcef936f63 blob - 20612fbcd658221acc5e29a7f900766e7f2b3ebc blob + 50a1da586318e80f32d33a7a17c4ceec91dc794c --- lua_close.3 +++ lua_close.3 @@ -3,7 +3,7 @@ .Os .Sh NAME .Nm lua_close -.Nd ensures that there are at least extra free stack slots in the stack, function indicator +.Nd destroys all objects and frees all dynamic memory, function indicator .Bq -0, +0, - .Sh SYNOPSIS .In lua.h @@ -11,10 +11,14 @@ .Fn lua_close "lua_State *L" .Sh DESCRIPTION .Fn lua_close -ensures that there are at least extra free stack slots in the stack. -It returns false if it cannot grow the stack to that size. -This function never shrinks the stack; if the stack is already larger than the -new size, it is left unchanged. +destroys all objects in the given Lua state (calling the corresponding +garbage-collection metamethods, if any) and frees all dynamic memory used by +this state. +On several platforms, you may not need to call this function, because all +resources are naturally released when the host program ends. +On the other hand, long-running programs, such as a daemon or a web server, +might need to release states as soon as they are not needed, to avoid growing +too large. .Sh SEE ALSO .Rs .%A Roberto Ierusalimschy blob - a8c39cf36b21bec13fcc76909d12af4c5511daf1 blob + f5e02fc0813935a39b4433b5aade66d3123f9d7b --- lua_close.3.html +++ lua_close.3.html @@ -18,8 +18,8 @@

lua_close — - ensures that there are at least extra free stack slots in - the stack, function indicator [-0, +0, -]

+ destroys all objects and frees all dynamic memory, function + indicator [-0, +0, -]

@@ -33,10 +33,13 @@

() - ensures that there are at least extra free stack slots in the stack. It - returns false if it cannot grow the stack to that size. This function never - shrinks the stack; if the stack is already larger than the new size, it is - left unchanged.

+ destroys all objects in the given Lua state (calling the corresponding + garbage-collection metamethods, if any) and frees all dynamic memory used by + this state. On several platforms, you may not need to call this function, + because all resources are naturally released when the host program ends. On + the other hand, long-running programs, such as a daemon or a web server, + might need to release states as soon as they are not needed, to avoid + growing too large.