View Single Post
Old 2008-03-26, 15:00   #8
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA (GMT-5)

792 Posts
Default

Quote:
Originally Posted by AES View Post
Isn't "job" the array from the joblist file?

You could just add:
Code:
write(fileprime, format("user=%s\n", job.user))
Function OnPrime:
Code:
function OnPrime(t, k, n, job)
   local fileprime = openfile("primes.txt", "a")
   if fileprime then
      write(fileprime, format("user=%s\n", job.user))
      write(fileprime, format("[%s]\n", job.resultdate))
      write(fileprime, format(displayFormat.." is prime!  Time : %d.0 sec.\n",
                  k, n,
                  Seconds() - job.seconds))
      closefile(fileprime)
   end
end
Ah, I see, I didn't notice that job was an array. Looked like a scalar to me. (since LUA, unlike most other programming languages, doesn't have an easy way to distinguish between scalars and arrays at a glance).
mdettweiler is offline   Reply With Quote