Jump to content

Setting for shaders (loadstring)


WASSIm.

Recommended Posts

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...