Cuberite Forum
How to use GetLastBedPos() - 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: How to use GetLastBedPos() (/thread-2944.html)



How to use GetLastBedPos() - moiko89 - 05-14-2017

Hi,

how i can use GetLastBedPos() for writing in Log?

LOG(Player:GetName() .. " Bed: " .. Player:GetLastBedPos())


RE: How to use GetLastBedPos() - xoft - 05-14-2017

You need to explicitly log the individual values:
local lastBedPos = Player:GetLastBedPos()
LOG(string.format("%s Bed: [%d, %d, %d]", Player:GetName(), lastBedPos.x, lastBedPos.y, lastBedPos.z))
(I prefer using string.format to concatenation, but either should work)


RE: How to use GetLastBedPos() - moiko89 - 05-14-2017

Thanks xoft!
How i can show into Objects in Lua? Can i debug my code?


RE: How to use GetLastBedPos() - xoft - 05-14-2017

You can debug Cuberite plugins using the ZeroBrane Studio, there's an article about setting it all up: https://api.cuberite.org/SettingUpZeroBrane.html

There's no built-in way to display Lua objects, basically because a Lua table can contain stuff that it cannot represent reasonably (functions, loops etc.)