need help,getting thiz: attempt to call global `readfrom' (a nil value
 

need help,getting thiz: attempt to call global `readfrom' (a nil value

Started by FrAcTi0n, 07 April, 2005, 16:36:13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

FrAcTi0n

attempt to call global `readfrom' (a nil value) on undermarked line... please help

function TextLoad(file,array,text) array[0]="" local x=0
   readfrom(file)
   repeat    if (text) then
         text=text..array[x].."\r\n"
      end
      x=x+1
      array[x]=read()
   until (array[x]==nil)
   readfrom()
   return text
end

thanx for help...

Stravides

firstly try to use [ code] and [ /code] tags but with no space after the initial bracket..

What the program is looking for is a function called readfile using parameter file

function ReadFile(bot,user,file,output)
	local handle = io.open(file, "r")
	local contents = string.gsub(handle:read("*a"), string.char(10), "\r\n")
	handle:close()
	if output=="main" then
		user:SendData(bot,"\r\n"..contents)
	elseif output == "pm" then
		user:SendPM(bot,"\r\n"..contents)
	end
	return contents
end

call the function with  
     ReadFile(bot, user, file, "pm") -- if outputting to PM
or
     ReadFile(bot, user, file, "main")  -- if to main chat
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

FrAcTi0n

hmm i am newbie in lua.. so i think i am not able to fix it...
would u please try to look on tho whole script?
script
thx

SMF spam blocked by CleanTalk