[SOLVED] Bug in cLuaWindow - 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: [SOLVED] Bug in cLuaWindow (/thread-1707.html) |
[SOLVED] Bug in cLuaWindow - wolfmitchell - 01-04-2015 So I made a quick plugin to mess around with creating windows via cLuaWindow, yet I get an error (which actually seems to be a bug in the lua "glue" of MCServer, I've been reading documentation for a few hours trying to fix this) Here is my code: PLUGIN=nil function Initialize(Plugin) Plugin:SetName("WndTest") Plugin:SetVersion(1) LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) PLUGIN=Plugin return true end function OnDisable() LOG(PLUGIN:GetName().." v."..PLUGIN:GetVersion().." is shutting down...") end function CommandTest(split,Player) Wnd=cLuaWindow(0,9,3,"Test") Wnd:SetSlot(Player,1,cItem(E_ITEM_DIRT,64)) Player:OpenWindow(Wnd) end cPluginManager.BindCommand("/wndtest","wndtest.use",CommandTest," - Test.") When I run that, I get this error in the console: Code: [18:47:07] LUA: error in function 'new'. edit: before one of my friends comes on here saying he wrote some of it too, he did, but it was mainly comments on the bottom left as a note for me that I omitted :p RE: Bug in cLuaWindow? - xoft - 01-04-2015 That's not a bug in cLuaWindow. If you look at the stacktrace that is presented right after the error message, you'll see that the actual error comes from the cItem constructor. And that would be because there's no such thing as E_ITEM_DIRT. Use E_BLOCK_DIRT instead. By the way, there is an example for using the cLuaWindow class in the Debuggers plugin, I've just tested it and it still works RE: Bug in cLuaWindow? - wolfmitchell - 01-05-2015 (01-04-2015, 08:20 PM)xoft Wrote: That's not a bug in cLuaWindow. If you look at the stacktrace that is presented right after the error message, you'll see that the actual error comes from the cItem constructor. And that would be because there's no such thing as E_ITEM_DIRT. Use E_BLOCK_DIRT instead. Ah, derp. Thought the error was in Wnd:SetSlot the whole time... Good job me. Thanks |