Let's say the sub A called the function B. And the sub D called the function B.
Is it possible in function B to find out what sub called this function?
B4X:
Private sub A
dim str as String
str=B()
End Sub
Private sub D
dim str as String
str=B()
End Sub
Private sub B as String
dim caller as String
caller=..... ' How to get this info?
if caller="sub A" then
return "Hello A"
else
return "Hello B"
end if
End Sub
Dim caller as public in globals. That way it will be visible throughout the module, and define it when calling.
Another possibility is to add it as an argument when calling the sub, like