From what I have been able to determine, it is not possible to call a function sub from a module.
For example, if I have a Main sub that adds two variables and returns the result, from a module I cannot say:
SumXY = CallSub(Main, "AddNums(x, y)")
Instead, I have to create a global variable "SumXY" in Main then set it to the sum in the AddNums sub and in the Module just use something like:
Is this correct, or am I missing something?
For example, if I have a Main sub that adds two variables and returns the result, from a module I cannot say:
SumXY = CallSub(Main, "AddNums(x, y)")
Instead, I have to create a global variable "SumXY" in Main then set it to the sum in the AddNums sub and in the Module just use something like:
B4X:
' Main:
Sub AddNums(x As Int, y As Int) As Int
SumXY = x + y
End Sub
' Module:
CallSub(Main, "AddNums(x, y)")
If Main.SumXY > 10 Then ...
Last edited: