Function Lua中函数的级联

Function Lua中函数的级联,function,lua,concatenation,Function,Lua,Concatenation,我试图通过使用Lua来连接一个函数,因为它实际上是一个球员名字的变量。游戏再次是命令和征服:叛徒 错误是:尝试连接本地“值”(一个函数值)这是通过使用Get\u Player\u Name\u by\u ID来实现的,但是,我不知道如何使用它,因为我需要能够确定哪个用户具有哪个杀手条纹!此外,它发生在210行附近。这在WriteINI函数中 这是我的密码: function OnChat(pID, Type, Message, Target) FindWords(Message) if Mes

我试图通过使用Lua来连接一个函数,因为它实际上是一个球员名字的变量。游戏再次是命令和征服:叛徒

错误是:
尝试连接本地“值”(一个函数值)
这是通过使用Get\u Player\u Name\u by\u ID来实现的,但是,我不知道如何使用它,因为我需要能够确定哪个用户具有哪个杀手条纹!此外,它发生在210行附近。这在WriteINI函数中

这是我的密码:

function OnChat(pID, Type, Message, Target)
FindWords(Message)

if Message == "!killstreaks" then
InputConsole("pamsg %d Killstreaks are a fundamental part of our server. You choose 3 killstreaks to be enabled for use, when you achieve a certain number of kills. Now type !select <Assault/Support>", pID)
end

if FirstW == "!select" or FirstW == "!choose" then
    if SecondW == "Assault" or SecondW == "assault" then
        InputConsole("pamsg %d Attack Chopper   Strafe Run   AH-6 Overwatch   Reaper   Assault Drone   AC130   Pavelow   Juggernaut   Oseprey Gunner", pID)
        InputConsole("pamsg %d UAV   Care Package   IMS   Predator Missile   Sentry Gun   Precision Airstrike", pID)
        InputConsole("pamsg %d  Now type !ks1 <killstreak>, then !ks2 <killstreak>, then !ks3 <killstreak> with 3 of these killstreaks:", pID)
            WriteINI("killstreaks.ini", "Choice", "Assault", Get_Player_Name_By_ID)
    elseif SecondW == "Support" or SecondW == "support" then
        InputConsole("pamsg %d EMP   Juggernaut Recon   Escort Airdrop", pID)
        InputConsole("pamsg %d UAV   Counter UAV   Ballistic Vests   Airdrop Trap   SAM Turret   Recon Drone   Advanced UAV   Remote Turret   Stealth Bomber", pID)
        InputConsole("pamsg %d Now type !ks1 <killstreak>, then !ks2 <killstreak>, then !ks3 <killstreak> with 3 of these killstreaks:", pID)
            WriteINI("killstreaks.ini", "Choice", "Support", Get_Player_Name_By_ID)
    end
end
return 1
end

function ReadINI(File, Section, KeyName)

blnSection = false
intAction = 0
strBracket = [[[]]

   if File ~= nil and Section ~= nil and KeyName ~= nil then
      if File ~= "" and Section ~= "" and KeyName ~= "" then
         i = io.open(File, "r")
         if i ~= nil then
            while true do
               local Line = i:read()   -- Reads a line
               if Line == nil or intAction ~= 0 then
                  break
               else
                  if blnSection == false then
                     Found = string.sub(Line, 0, 1)
                 if Found == strBracket then -- Found Header
                    Header = string.sub(Line, 2, -2)
                    if Header == Section then
                       blnSection = true
                    end
                 end
              else
                 Header = string.sub(Line, 0, 1)
                 if Header == strBracket then
                    intAction = 2
                 elseif Header == ";" then
                    -- Ignor Comments
                 elseif Line == "" then
                    -- Ignor Blank Lines
                 else
                    strFindEqual = string.find(Line, "=")
                    if strFindEqual ~= nil then
                       strKeyname = string.sub(Line, 0, strFindEqual - 1)
                       if strKeyname == KeyName then
                          intAction = 1
                          Value = string.sub(Line, strFindEqual + 1)
                       end   
                    end
                 end
              end
           end
        end

        i:close()

        if intAction == 1 then
           return Value
        elseif intAction == 2 then
           return NoneError
        else
           return NoneError
        end   
     else
        return FileError
     end
      else
         return ArgError
      end
   else
      return ArgError
   end
end


function WriteINI(File, Section, KeyName, Value)

   blnSection = false
   intAction = 0
   strBracket = [[[]]
   strCloseBracket = [[].]]
   strCloseBracket = string.sub(strCloseBracket, 1, 1)
   Save = ""

   if File ~= nil and Section ~= nil and KeyName ~= nil and Value ~= nil then
      if File ~= "" and Section ~= "" and KeyName ~= "" and Value ~= "" then
         i = io.open(File, "r")
         if i ~= nil then
        while true do
           local Line = i:read()   -- Reads a line
           if Line == nil then
              break
           else
              if intAction == 0 then
                 if blnSection == false then
                    Found = string.sub(Line, 0, 1)
                    if Found == strBracket then -- Found Header
                       Header = string.sub(Line, 2, -2)
                       if Header == Section then
                          blnSection = true
                       end
                    end
                 else
                    Header = string.sub(Line, 0, 1)
                    if Header == strBracket then
                       blnSection = false
                       Line = KeyName .. "=" .. Value .. "\n" .. Line
                       intAction = 1
                    elseif Header == ";" then
                       -- Ignor Comments
                    elseif Line == "" then
                       -- Ignor Blank Lines
                    else
                       strFindEqual = string.find(Line, "=")
                       if strFindEqual ~= nil then
                          strKeyname = string.sub(Line, 0, strFindEqual - 1)
                          if strKeyname == KeyName then
                             Line = KeyName .. "=" .. Value
                             intAction = 1
                          end   
                       end
                    end
                 end
              end

              Save = Save .. Line .. "\n"
           end
        end

        i:close()

        if intAction ~= 1 then
           if blnSection == false then
              Save = Save .. strBracket .. Section .. strCloseBracket .. "\n" .. KeyName .. "=" .. Value
           else
              Save = Save .. KeyName .. "=" .. Value
           end
        end

        i = io.open(File, "w")
           i:write(Save)
        i:close()
     else
        i = io.open(File, "w")
           i:write(strBracket .. Section .. strCloseBracket .. "\n" .. KeyName .. "=" .. Value)
        i:close()
       end
      else
         return ArgError
      end
   else
      return ArgError
   end
end

function FindWords(Text)

   Found = string.find(Text, " ")
   if Found ~= nil then
      FirstW = string.sub(Text, 0, Found - 1)
      SecondW = string.sub(Text, Found + 1)
      SecondPlus = SecondW

      Found = string.find(SecondW, " ")
      if Found ~= nil then
     ThirdW = string.sub(SecondW, Found + 1)
     SecondW = string.sub(SecondW, 0, Found - 1)
     ThirdPlus = ThirdW

     Found = string.find(ThirdW, " ")
     if Found ~= nil then
        FourthW = string.sub(ThirdW, Found + 1)
        ThirdW = string.sub(ThirdW, 0, Found - 1)

        Found = string.find(FourthW, " ")
        if Found ~= nil then
           FourthW = string.sub(FourthW, 0, Found - 1)
        end
     else
        FourthW = ""
     end
     else
     ThirdW = ""
     ThirdPlus = ""
     FourthW = ""
  end
   else
  FirstW = Text
  SecondW = ""
  SecondPlus = ""
  ThirdW = ""
  ThirdPlus = ""
  FourthW = ""
   end
end
函数OnChat(pID、类型、消息、目标) FindWords(消息) 如果消息==“!killstreaks”,则 InputConsole(“pamsg%d Killstreaks是我们服务器的基本组成部分。当您达到一定数量的Killstreaks时,您可以选择3个Killstreaks以供使用。现在键入!选择”,pID) 结束 如果FirstW==“!select”或FirstW==“!choose”,则 如果SecondW==“攻击”或SecondW==“攻击”,则 输入控制台(“pamsg%d攻击直升机扫射运行AH-6守望收割者攻击无人机AC130 Pavelow Juggernaut Oseprey炮手”,pID) 输入控制台(“pamsg%d无人机护理包IMS捕食者导弹岗哨炮精确空袭”,pID) InputConsole(“pamsg%d现在键入!ks1,然后!ks2,然后!ks3,其中有3个killstreak:,pID) WriteINI(“killstreaks.ini”,“选择”,“攻击”,通过ID获取玩家姓名) 如果第二个W==“支持”或第二个W==“支持”,则 输入控制台(“pamsg%d EMP巨型机侦察护航空投”,pID) 输入控制台(“pamsg%d无人机对抗无人机弹道背心空投陷阱SAM炮塔侦察无人机先进无人机远程炮塔隐形轰炸机”,pID) InputConsole(“pamsg%d现在键入!ks1,然后!ks2,然后!ks3,其中有3个killstreak:,pID) WriteINI(“killstreaks.ini”,“选择”,“支持”,通过ID获取玩家姓名) 结束 结束 返回1 结束 函数ReadINI(文件、节、键名) blnSection=false intAction=0 strBracket=[[]] 如果File~=nil,Section~=nil,KeyName~=nil,那么 如果文件~=''和节~=''以及键名~='',则 i=io.open(文件“r”) 如果i~=nil那么 尽管如此 本地行=i:read()--读取一行 如果Line==nil或intAction~=0,则 打破 其他的 如果blnSection==false,则 Found=string.sub(第0行,第1行) 如果Found==strBracket,则--Found头 Header=string.sub(第2-2行) 如果Header==节,则 blnSection=true 结束 结束 其他的 Header=string.sub(第0行,第1行) 如果Header==strBracket,则 intAction=2 elseif头==“;”然后 --无知者评论 elseif Line==”“那么 --忽略空白行 其他的 strFindEqual=string.find(行“=”) 如果strfinequal~=nil,则 strKeyname=string.sub(第0行,strfinequal-1) 如果strKeyname==KeyName,则 intAction=1 Value=string.sub(行,strfinequal+1) 结束 结束 结束 结束 结束 结束 一:关() 如果intAction==1,则 返回值 elseif intAction==2,则 返回非错误 其他的 返回非错误 结束 其他的 返回文件错误 结束 其他的 返回箭头 结束 其他的 返回箭头 结束 结束 函数WriteINI(文件、节、键名、值) blnSection=false intAction=0 strBracket=[[]] strCloseBracket=[[].]] strCloseBracket=string.sub(strCloseBracket,1,1) Save=“” 如果File~=nil,Section~=nil,KeyName~=nil,Value~=nil,那么 如果文件~=''和节~=''以及键名~=''和值~='',那么 i=io.open(文件“r”) 如果i~=nil那么 尽管如此 本地行=i:read()--读取一行 如果Line==nil,则 打破 其他的 如果intAction==0,则 如果blnSection==false,则 Found=string.sub(第0行,第1行) 如果Found==strBracket,则--Found头 Header=string.sub(第2-2行) 如果Header==节,则 blnSection=true 结束 结束 其他的 Header=string.sub(第0行,第1行) 如果Header==strBracket,则 blnSection=false Line=KeyName..“=”.Value..“\n”.Line intAction=1 elseif头==“;”然后 --无知者评论 elseif Line==”“那么 --忽略空白行 其他的 strFindEqual=string.find(行“=”) 如果strfinequal~=nil,则 strKeyname=string.sub(第0行,strfinequal-1) 如果strKeyname==KeyName,则 行=键名..“=”。值 intAction=1 结束 结束 结束 结束 结束 保存=保存..行..“\n” 结束 结束 一:关() 如果intAction~=1,则 如果blnSection==false,则 Save=Save..strBracket..Section..strCloseBracket..“\n.”.KeyName..“=”.V
WriteINI(a,b,c,Get_Player_Name_By_ID)
WriteINI(a,b,c,Get_Player_Name_By_ID(Player_ID))