Piorun Posted August 8, 2015 Share Posted August 8, 2015 Hi, I know that in "normal" programming lang i must close db connection. How is it possible to do in MTA (using Lua and db... functions)? Link to comment
GTX Posted August 8, 2015 Share Posted August 8, 2015 Use destroyElement to close DB connection. Link to comment
ixjf Posted August 9, 2015 Share Posted August 9, 2015 Piorun said: Hi,I know that in "normal" programming lang i must close db connection. How is it possible to do in MTA (using Lua and db... functions)? That is wrong. If you need to close the database connection in the middle of the execution of the script, then you can use destroyElement. Otherwise, you can just let Lua's garbage collector close the database connection automatically when it is no longer referenced anywhere in your code (or, for example, when you stop the resource). In other languages, for example, C++, even though you don't have garbage collection, you have idioms like RAII (Resource Acquisition Is Initialization), which take care of that. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now