Page 1 of 1

Tiled plugin

Posted: Wed Dec 01, 2010 7:18 am
by yufra
So I was taking another look at the Tiled plugin and think I found a potential bug. I think the " and \ characters both need to be escaped in Lua when not inside the double square brackets, and currently that is not robust. I want to change the multiple character handling to use the square brackets, for example:

Code: Select all

defineTile("\"\"", "GRASS", nil, nil, {random_filter={add_levels=5}})
...
return {
...
{[[$]],[[,]],[[,]],[[""]],[[""]],[[""]],[[""]],[[,]],[[,]],[[$]],},
{[[$]],[[$]],[[$]],[[$]],[[%]],[[$]],[[$]],[[$]],[[$]],[[$]],},}
The single character handling will be handled like this:

Code: Select all

defineTile("\"", "GRASS", nil, nil, {random_filter={add_levels=5}})
...
return [[
...
$,,"""",,$
$$$$&$$$$$]]
Does that seem ok?

Re: Tiled plugin

Posted: Wed Dec 01, 2010 8:11 am
by darkgod
Sounds valid, you can use luac (which comes with lua) to test syntax validity BTW:
luac -p foo.lua

Re: Tiled plugin

Posted: Wed Dec 01, 2010 5:49 pm
by yufra
Patch submitted.