Ah, the file wasn't opened successfully,  so f was null.  
I really should be more careful about these things!

steve d.

>>> [EMAIL PROTECTED] 05/24/05 3:39 AM >>>
What is wrong with the following Lua function? This is taken from 
"scite_other.lua" by Steve Donovan. I marked the error line in the 
code below. The error message is:

attempt to index local `f' (a nil value)


function Perform(verb,arg,other)
   local f = io.open(TEMP_FILE_IN,'w')
   if not arg then
      arg = ''
   else
    -- exec is a special verb _not_ handled by the Director interface,
    -- which otherwise requires its input to be slashified.
     if verb ~= 'exec' then
       arg = string.gsub(arg,'\\','\\\\')
     end
   end
   local cmd = 1
   if other then cmd = 0 end
   f:write(verb,':',arg,'\n')
   f:write(cmd,' ',our_window,'\n')
   f:close()
   fn()
   f = io.open(TEMP_FILE_OUT,'r')
   local n = f:read('*n') -- < error here
   f:read()
   if n == 1 then
      our_window = f:read()
   end
end


-- 
Doyle Whisenant
http://www.freewebs.com/mekdesign/ 
"mechanic" at "sonet" dot "net"

_______________________________________________
Scite-interest mailing list
[email protected] 
http://mailman.lyra.org/mailman/listinfo/scite-interest


_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to