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
end
x=x+1
array
until (array
readfrom()
return text
end
thanx for help...
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
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 (http://junglist.cz/DB_v08-t.lua)
thx