mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-15 17:25:32 +00:00
Lua API: When creating a location set from triples, also support tables with x, y, and value keys
This commit is contained in:
parent
c59c3b9273
commit
08e3a31979
@ -277,7 +277,11 @@ function methods:of_triples(t)
|
||||
-- Create a location set from a table of 3-element tables
|
||||
-- Elements 1 and 2 are x,y coordinates, #3 is value to be inserted
|
||||
for k,v in pairs(t) do
|
||||
self:insert(v[1], v[2], v[3])
|
||||
if #v == 0 then
|
||||
self:insert(v.x, v.y, v.value)
|
||||
else
|
||||
self:insert(v[1], v[2], v[3])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user