Closed StyledStrike closed 3 years ago
IsValid(this)
this:IsValid()
webaudio:isValid()
@persist WA_TTS:webaudio ... if (WA_TTS:isValid()) { WA_TTS:destroy() } WA_TTS = webAudio("...") WA_TTS:setParent(entity()) WA_TTS:play()
Will throw this error:
sv: Expression 2 (generic): entities/gmod_wire_expression2/core/custom/webaudio.lua:228: attempt to index local 'this' (a nil value)
Nice thanks
IsValid(this)
instead ofthis:IsValid()
when callingwebaudio:isValid()
. Otherwise, say we want to check if we created a webaudio previously and want to delete it before creating a new one, like on this snippet:Will throw this error:
sv: Expression 2 (generic): entities/gmod_wire_expression2/core/custom/webaudio.lua:228: attempt to index local 'this' (a nil value)