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

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
  1. local dt_lava = {["name"]="test_lave",["layer"]=1,["x"]=320,["y"]=336,["width"]=32,["height"]=32,["tile_pattern_id"]="lava",["enabled_at_start"]=true}
  2.  
  3. 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
  1. local dt_lava = {["name"]="test_lave",["layer"]=1,["x"]=320,["y"]=336,["width"]=32,["height"]=32,["pattern"]="lava",["enabled_at_start"]=true}
  2.  
  3. local dt_test = map:create_dynamic_tile(dt_lava)

No errors and

Christopho

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