I'm currently converting my Lexical Analyzer module that is written in VB.Net to Lua. In that module, I have a scan function which scans the source code and breaks up code into tokens. Currently this is how I'm doing it:
Public Function Scan(ByVal source As String, ByRef tokens() As String, ByRef values() As String) As String()
The way that it works is it sets my tokens and values through the ByRef arguments and returns a string array that represent any errors. So if the Scan function returns an empty string array, then that is good because that means that there are no syntax errors.

However, in Lua, I can't seem to find the ByRef argument. I'm sure that I can create three functions, one to return the tokens, one to return the values and one to return the exceptions, but that seems awfully redundant. I could also just have the tokens and values set as global variables outside of the function, but that doesn't seem like good design. What do y'all suggest?