Jump to content

loadstring


Recommended Posts

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

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