#Is there a way to return an isolated variable from an isolated function?

1 messages · Page 1 of 1 (latest)

radiant ferry
#

I am referring to the following code. When I try to return the "outputsIso" json array from the function, it gives "invalid access of an 'isolated' variable outside a 'lock' statement(BCE3962)" error. Is there a way that I can return the outputIso variable from this function?

rich junco
#

As indicated by the error message, you will have to use a lock statement when accessing an isolated variable. Moreover, the return statement will have to be updated so that the expression is an isolated expression (e.g., using .clone()).

lock {
    return outputIso.clone();
}