`source` is not retained after a TriggerEvent call

@Deltanic ran into this, the following code example will invalidate source as the script runtime (scheduler) will overwrite source during the event routine:

AddEventHandler('test', function()
    print('source: ' .. tostring(source))
    TriggerEvent('test2', source)
    print('source: ' .. tostring(source)) -- source disappears at this point
end)
5 Likes

True, i have the same issue so i use that:

AddEventHandler('test', function()
    local Source = source
    print('source: ' .. tostring(source))
    TriggerEvent('test2', Source)
    print('source: ' .. tostring(Source)) -- source disappears at this point
end)

But it will definitely be cool if its fixed