(Newbie) Needing Plugin Help (lua) - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: (Newbie) Needing Plugin Help (lua) (/thread-1221.html) |
(Newbie) Needing Plugin Help (lua) - Sea - 08-15-2013 Hello, I'm new to lua and I've started created plugins for a new server that I will be helping with, I made my first plugin and it was working fine until I went to go add the permissions, I looked at the file for the permissions then restarted the server, the console then gave my the following error: Code: LUA: 2 - Plugins/SeaCustom/main.lua:10: "BindCommand" function expects a function as its 3rd parameter. Command-binding aborted. Here is the code (main.lua): Code: PLUGIN = {} Any help would be greatly appreciated, if possible, an explanation would be nice but if there is none that is fine RE: (Newbie) Needing Plugin Help (lua) - xoft - 08-15-2013 Hello, welcome to the forum. The error basically tells you that the 3rd parameter to BindCommand() is wrong. It also tries to guess what's wrong with it. In this case, it was expecting a function as the parameter, but you seem to give it something else. What is your HandleHealCommand, is it defined? Is it a function? RE: (Newbie) Needing Plugin Help (lua) - bearbin - 08-15-2013 Yeah the problem is probably that you have not defined your function. RE: (Newbie) Needing Plugin Help (lua) - tonibm19 - 08-15-2013 Look at other plugins and see what's the correct way of binding commands RE: (Newbie) Needing Plugin Help (lua) - NiLSPACE - 08-15-2013 Also a tip, if you post code on the forum you can use Code: [shcode=lua] Code here [/shcode] PLUGIN = {} --Commands function Initialize( Plugin ) PLUGIN = Plugin Plugin:SetName( "SeaCustom" ) Plugin:SetVersion( 0.1 ) PluginManager = cRoot:Get():GetPluginManager() PluginManager:BindCommand("/heal", "SeaCustom.heal", HandleHealCommand, " ~ Heal yourself!") PluginManager:BindCommand("/killstats", "SeaCustom.killstats", HandleKillStatsCommand, " - Lose the game!") return true end RE: (Newbie) Needing Plugin Help (lua) - Sea - 08-15-2013 Thanks for all the help guys the main.lua wasn't the issue, it was that my Heal.lua had function HandleKillStatsCommand( Split, Player )instead of function HandleHealCommand( Split, Player )I guess I saved the killstats file it over on accident |