In 2.9 you will be able to set properties in Tiled via Lua code in Lime.
Essentially you create a small module that has a main() function and returns a value. What that function does is up to you. You would then call that file “lime-seed-seedName.lua” and call it in Tiled by setting the value of a property to this:
“seed:seedName”
They are explained here - http://justaddli.me/seeds.php - and include an example seed that will explain things. [import]uid: 5833 topic_id: 6848 reply_id: 306848[/import]
Also, I’ve never used unpack before as I think I recall reading somewhere that it was a slight performance hit? I can’t remember though so if I’m wrong I will be happily corrected. Does unpack play nicely if the params argument was nil? [import]uid: 5833 topic_id: 6848 reply_id: 23937[/import]
Not sure about the performance hit - cannot imagine that it would be anything you could measure - specially compared to all the xml parsing you are doing
Anyway, unpack is an extremely useful function to transform a table-array into a list of values, either for return values or to use a table-array for the function argument values. You can even specify the array indices for the range of elements to use.
You were right to be concerned about nil values as unpack(nil) would blow up . A more prudent version would be:
[lua] function main(params) return math.random(unpack(params or {})) end[/lua]
or even better
[lua] function main(params) return type(params)==“table” and math.random(unpack(params)) end[/lua]
-FS.
[import]uid: 8093 topic_id: 6848 reply_id: 23942[/import]
i am now trying to use seeds to give tiles (not objects, but background tiles) properties like being able to drag them or change their physics behavior… any thoughts? (i can’t get tile:drag() to do what I want it to)