Rick Posted January 15, 2012 Posted January 15, 2012 Is there a way to free a material in lua? I've tried FreeMaterial(mat) and mat:Free() and both give me an error saying they don't exist. Quote
macklebee Posted January 15, 2012 Posted January 15, 2012 just simply set the material to nil... but you also have to remove it from wherever it was being used by either freeing the mesh or painting that mesh a different material. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
Josh Posted January 15, 2012 Posted January 15, 2012 Please do not add tags in the thread title. Just set the variable to NULL and it will get cleaned up automagically. You can call collectgarbage() in Lua to force a cleanup after setting the variable: http://www.lua.org/manual/5.1/manual.html#pdf-collectgarbage Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Rick Posted January 15, 2012 Author Posted January 15, 2012 So can I technically do that with all LE entities? Why have :Free() for other entities like meshes then? Please do not add tags in the thread title. Sorry I didn't see a Lua forum but other languages have one so thought I'd give it some more info in the generic forum. Quote
Josh Posted January 15, 2012 Posted January 15, 2012 The other language subforums are closed for new topics. They'll be merged into the main programming forum soon. Entities require manual freeing because they have too many linkages to ever be collected by the GC. I'm not a big fan of GC because of things like this. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.