LUA - how to make function call in action.command and send output to a file?

Discussion created by hthai on Oct 24, 2008
Latest reply on Jul 9, 2009 by carstein.seeberg

This is a continuous thread from my first post about LUA.

<1> My lib


function myplink ()
   local plink = "D:\\WIT\\Commands\\Restart\\plink.exe"
   return plink


<2> My script

require ("library/gait-arguments")

buf = action.command ("myplink () -v -i D:\\WIT\\jobs\\wit\\.ssh2\\nanimbus5-rsa-key-1024-20080513-x86.ppk -batch aiadm@ds6 ls -l /tmp")

for i=1,#buf do
   printf ("%02d -> %s",i,buf >> "D:\\WIT\\Commands\\Restart\\logs\\test.log")


<3> My objective:
In (2), I want to make a function call myplink() in the action.command then capture the output in a file.  I'm fairly new to LUA and have been checking out some of the examples from Help and the Wiki online for user-lua site, but I haven't got (2) to work.

Your suggestion is appreciated.