./BlackBird# Posted July 8, 2014 Share Posted July 8, 2014 Hi =) i'm using loadstring to run files but my problem is how to stop loadstring like playSound how to Stop it with compiled files Link to comment
xXMADEXx Posted July 8, 2014 Share Posted July 8, 2014 You need to define the sound element in in a variable then use destroyElement... Link to comment
./BlackBird# Posted July 8, 2014 Author Share Posted July 8, 2014 You need to define the sound element in in a variable then use destroyElement... how to define it with compiled file Link to comment
MIKI785 Posted July 8, 2014 Share Posted July 8, 2014 Simply redefine the playSound function... or you could use getElementsByType("sound") to get it. Link to comment
Max+ Posted July 8, 2014 Share Posted July 8, 2014 You need to define the sound element in in a variable then use destroyElement... how to define it with compiled file you can't , but ithink if you used , loop for the element sound , you can destory it , Link to comment
./BlackBird# Posted July 8, 2014 Author Share Posted July 8, 2014 what about addEventHandler how to remove it Link to comment
MIKI785 Posted July 8, 2014 Share Posted July 8, 2014 It's the same thing again... redefine the function and keep the handlers in a table then run through it and remove them. Link to comment
Max+ Posted July 8, 2014 Share Posted July 8, 2014 It's the same thing again... redefine the function and keep the handlers in a table then run through it and remove them. he can't becuase the script is compiled , i dont think it's his , he should use loop for sounds , then destroy it , Link to comment
MIKI785 Posted July 8, 2014 Share Posted July 8, 2014 He's using loadstring... you can replace any function you want... that's how lua works you know. I did this myself so i know.. Link to comment
./BlackBird# Posted July 8, 2014 Author Share Posted July 8, 2014 He's using loadstring... you can replace any function you want... that's how lua works you know. I did this myself so i know.. i can but the code is compiled Link to comment
Max+ Posted July 8, 2014 Share Posted July 8, 2014 He's using loadstring... you can replace any function you want... that's how lua works you know. I did this myself so i know.. compiled files Edit any thing will make it not work.. Link to comment
ixjf Posted July 8, 2014 Share Posted July 8, 2014 local soundElements = {} local _playSound = playSound function playSound ( ... ) local sound = _playSound ( ... ) if sound then table.insert ( soundElements, sound ) end return sound end loadstring ( codeThatCallsplaySound ) () Or in a sandbox: local soundElements = {} local env = deepcopy ( _G ) function env.playSound ( ... ) local sound = playSound ( ... ) if sound then table.insert ( soundElements, sound ) end return sound end local func = loadstring ( codeThatCallsplaySound ) setfenv ( func, env ) func () The implementation of deepcopy can be found here. Link to comment
./BlackBird# Posted July 9, 2014 Author Share Posted July 9, 2014 Thanks ixjf Works fine =) Link to comment
MIKI785 Posted July 10, 2014 Share Posted July 10, 2014 He's using loadstring... you can replace any function you want... that's how lua works you know. I did this myself so i know.. compiled files Edit any thing will make it not work.. Then you simply dont know Lua... look at ixjf's post and learn. 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