Invalid handler with info.lua
#1
I have been experimenting with the info.lua file and am now stuck at one point where it says "Invalid handler for command /ping, command will not be registered." I have added the handler for the command as "PingPlayer" and written the handler out in ping.lua. Below I added my info.lua and ping.lua files. (Note: all other commands + Handlers work). What's the issue? Thanks.
INFO.LUA
g_PluginInfo =
{
  Name = "Basics",
  Version = "0.1",
  Description = "Adds some basic commands",

  Commands =
  {
    ["/heal"] =
    {
      Permission =  "basic.heal",
      HelpString =  " Heal player to full health.",
      Handler =  HealPlayer,
    },

    ["/ping"] =
    {
      Permission =  "basic.ping",
      HelpString =  " Get a players ping to the server.",
      Handler =  PingPlayer,
    },

    ["/feed"] =
    {
      Permission =  "basic.feed",
      HelpString =  " Feed player to full hunger.",
      Handler =  FeedPlayer,
    },
  },
}

ping.lua
function PingPlayer(Split, Player)
  if Split[2] == nil then
    Player:SendMessageSuccess(Player:GetClientHandle():GetPing())
  elseif(Player:HasPermission("basics.ping.other")) then
    local Ping = function(OtherPlayer)
      if (OtherPlayer:GetName() == Split[2]) then
        Player:SendMessageSuccess("Player " .. Split[2].."ping: " .. OtherPlayer:GetClientHandle():GetPing())
        return true
      end
    end
    if (not(cRoot:Get():FindAndDoWithPlayer(Split[2], Ping))) then
      Player:SendMessageFailure("Player not found.")
    end
  end
  return true
end
Reply
Thanks given by:
#2
This should work. Are you on Linux? You need to observe filename capitalization, the server expects the Info.lua file to have uppercase I and all the other letters lowercase. This is important, because the Info.lua file needs to be loaded as the last file in the plugin.
Reply
Thanks given by: gv1222
#3
Capitalizing the I in Info.lua fixed it, thanks. And for the record this was on windows not linux
Reply
Thanks given by:
#4
Hmm, we may have a problem here. We expect the filesystem to preserver letter case, which just happens to be true for WinXP+, but is not always guaranteed. What if there was a filesystem that reported all the filenames in uppercase, like DOS used to?

Shall we keep assuming that the Info.lua file is properly capitalized, or shall we allow for case-insensitiveness for this particular file?
Reply
Thanks given by:
#5
The only way I can see this being a problem is if someone what to support burning plugins to CDs, the ISO 9660 file system only supports upper-case.
Reply
Thanks given by:




Users browsing this thread: 11 Guest(s)