[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Location of function declaration??
- From: Mike Crowe <mike@...>
- Date: Thu, 21 Oct 2004 23:22:36 -0400
Hi folks,
Sorry to pound with the group with n00b questions, but here's another one.
I'm parsing a text file, and wanted to declare a function to print the
table I'm building. Code is below.
Here's the question:
I see I have to declare function before using. However, it appears that
the function executes once as the system runs. I had to put in the
statement below "if tab[1] then" to catch the first run with a nil.
Shouldn't the function only been called when I call it below?
t = {}
index = 0
local printTable
function printTable(tab)
if tab[1] then
...
end
end
for line in io.lines("test.txt") do
--build table here
printTable(t)
end
TIA
Mike