First off, this isn't for beginners. It uses a few more advanced concepts to implement what it does. Use carefully, and ask if you're unsure of how to use it. When in doubt, use the premade function at the end.
So, many times now I've run into functions I've tested for others with... problems. Specifically, many functions have been made primarily by beginning coders which create a large number of variables outside of a namespace, sometimes overwriting important functions or otherwise mussing up the global environment. For the odd times when rewriting these isn't reasonable, feasible, or possible for whatever reason, I wrote up a little patch script.
First off, you'll need the deepcopy function from http://lua-users.org/wiki/CopyTable. I've included it below, with the adjustment to deepcopy metatables as well:
Worth note: This isn't completely foolproof technically. Using rawset can bypass the deepcopy protection, changing the local environment will quite obviously mess this up, and changes to the environment's metatable will interfere with it as well. On the other hand, if the script is doing any of these things, chances are the author should know better than to write in such a way where this is necessary.
It's possible to wrap this all into a simple function to implement quickly as well, like so:
1 post • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest