Author Topic: map:create_dynamic_tile() - documentation correction  (Read 3370 times)

0 Members and 1 Guest are viewing this topic.

Realguigui

  • Newbie
  • *
  • Posts: 20
  • Eastmost penninsula is the secret
    • View Profile
map:create_dynamic_tile() - documentation correction
« on: January 21, 2017, 06:03:30 PM »
Hello.

After trying the function map:create_dynamic_tile() with the help of the documentation, it seems that the name of the key in the table "properties" that indicated the name of the pattern is "pattern" and not "tile_pattern_id".

Code with wrong key
Code: (lua) [Select]
local dt_lava = {["name"]="test_lave",["layer"]=1,["x"]=320,["y"]=336,["width"]=32,["height"]=32,["tile_pattern_id"]="lava",["enabled_at_start"]=true}

local dt_test = map:create_dynamic_tile(dt_lava)

Debug Console
Code: [Select]
Info: Simulation started
Error: In on_started: [string "maps/donjon01_01.lua"]:29: bad argument #1 to create_dynamic_tile (Bad field 'pattern' (string expected, got nil))
Info: Simulation finished

Code with the key "pattern"
Code: (lua) [Select]
local dt_lava = {["name"]="test_lave",["layer"]=1,["x"]=320,["y"]=336,["width"]=32,["height"]=32,["pattern"]="lava",["enabled_at_start"]=true}

local dt_test = map:create_dynamic_tile(dt_lava)

No errors and

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
Re: map:create_dynamic_tile() - documentation correction
« Reply #1 on: January 22, 2017, 02:41:22 PM »
This is fixed, thanks noticing!