Page 1 of 1

Lua: How to get the draft id of the Ground?

Posted: 29 Jan 2019, 14:34
by Wekabu city
So I want to check the Ground Draft Id of x,y , but somehow it will always Not enter my if-clause (or iff how the documentation spells that) even though it is true (Well i think)

If (Tile.getGroundDraft(x,y).getId() == "$ground00") then
(Code)

So yeah, how to use it then? The Doc should be more clear

Re: Lua: How to get the draft id of the Ground?

Posted: 06 Feb 2019, 14:11
by Lobby
Please provide your full code to exclude other issues.

From what I can see you have to use : instead of . in front of getId() since it's a method that will be called on an object. That might look strange but this is how Lua works :lua:

Code: Select all

if (Tile.getGroundDraft(x,y):getId() == "$ground00") then

Re: Lua: How to get the draft id of the Ground?

Posted: 01 May 2019, 14:27
by Wekabu city
Ended up that I used the wrong charset/encoding

Re: Lua: How to get the draft id of the Ground?

Posted: 01 May 2019, 16:20
by Lobby
:bc
Always use UTF8 if possible.