WASSIm. Posted November 3, 2014 Share Posted November 3, 2014 hi guys, need help for make setting shader, so i make setting system and i have setting panel... so i want add shaders setting in panel and i get it but some shaders don't work 100% bcs create many screens with dxCreateScreenSource i use export but don't work, so i need merge them in same resource but i will get some problems so i have idea to use loadstring for loading scripts shader but i don't know how unload them, please anyone have idea ? Sry for bad english Link to comment
Saml1er Posted November 4, 2014 Share Posted November 4, 2014 local Elements = { } _dxCreateScreenSource = dxCreateScreenSource function dxCreateScreenSource (...) local a = _dxCreateScreenSource ( ... ) if a then Elements[#Elements+1] = a return a else return false end end _dxCreateShader = dxCreateShader -- copy the function for later use function dxCreateShader ( ... ) --rewrite it so when it's called we can use our copied function and insert the element into table local a = _dxCreateShader ( ... ) if a then Elements[#Elements+1] = a return a else return false end end local unLoad1 () for _,v in pairs ( Elements ) do if isElement ( v ) then destroyElement (v ) end end end You must also insert timers and event handlers into tables since they will keep running even if you nil the function you loaded using loadstring so it's better to unload them as well using killTimer and removeEventHandler. 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