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

Plug-in related stuff can be discussed here.

Moderator: Plugin Moderators

User avatar
Wekabu city
Inhabitant of a Megalopolis
Reactions:
Posts: 586
Joined: 29 Aug 2017, 21:07
Location: Germany, Hessia
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

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

#1

Post 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

User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

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

#2

Post 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

User avatar
Wekabu city
Inhabitant of a Megalopolis
Reactions:
Posts: 586
Joined: 29 Aug 2017, 21:07
Location: Germany, Hessia
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

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

#3

Post by Wekabu city »

Ended up that I used the wrong charset/encoding

User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

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

#4

Post by Lobby »

:bc
Always use UTF8 if possible.

Post Reply Previous topicNext topic

Return to “Plug-In Discussion”