I have a function which I want to return two values, cost and desc. In the following code, desc is printed out but on in the script that is trying to reference desc it is nil.

print(desc) --prints the desc
return cost, desc

However, in the other script

local cost, desc=getinfo(name) --the function
print(cost) --prints the cost
print(desc) --prints nil

Does anyone know why this is not working? Thanks.

1 comment

2

Can you provide more context? You've probably dropped something important. e.g., if they're defined in other scripts, how are they communicating? etc