could somebody convert this script to lua 5 for me please & t/y
--Readme 1.0
--by Mutor
--
Command ="+commands"
TextFile ="commands.txt"
Send2All ="no" --Show all users? "yes"/"no"
--
function DataArrival(user, data)
local s,e,cmd = strfind(data,"^%b<>%s(%S+)|")
if cmd == Command then
ReadText(user)
return 1
end
end
function ReadText(user)
readfrom(TextFile)
while 1 do
local line = read()
if line == nil then break end
if Send2All =="yes" then
SendToAll(line)
else
user:SendData(line)
end
end
readfrom()
end
--Readme 1.0
--by Mutor
--
Command ="+commands"
TextFile ="commands.txt"
Send2All ="no" --Show all users? "yes"/"no"
--
function ChatArrival(user, data)
local s,e,cmd = string.find(data,"^%b<>%s(%S+)|")
if cmd == Command then
ReadText(user)
return 1
end
end
function ReadText(user)
local f=io.open(TextFile)
if f then
local contents = string.gsub(f:read("*a"),string.char(10), "\r\n")
if Send2All =="yes" then
SendToAll(contents)
else
user:SendData(contents)
end
f:close()
end
end
You'd better use the builtin PtokaX textfile support.
excellent t/y :)
would you be interested in converting a few more if i need them ?
QuoteOriginally posted by slick
would you be interested in converting a few more if i need them ?
Post them with CODE tag, there are many volunteers here, I go to sleep now.