This is my first foray into LUA and WoW Addon development. So apologies in advance for the naivity.
Note the call to assert() in the function below. While it terminates the program correctly, it doesn't print the error message to the chat frame.
This is so simple that I'm convinced I'm missing something. Does assert(), for example, use a different output that the chat frame?
Any help would be very much appreciated.
assert( nil, "function terminated.")
stackInfo = debugstack()
print( stackInfo )
-- Get the line number from where the function was called
for number in string.gmatch(stackInfo, "%d+>")
print("Function definition at line ", string.match( number, "%d+"))
-- Get line number where function was called.
for number in string.gmatch(stackInfo, "%d+:")
print("Function called at line ", string.match( number, "%d+"))
Completely off-topic, but since you mentioned you're new at this, please have a look at how to scope your variables properly.
Generally speaking, global variables should only be used for things you want to access externally.