Hello.
I have experience with AS3. I wonder what it would be in
Lua language:
[as3]var numBots:int = 10;
for (var i:int = 0; i < numBots, i ++) {
this[“bot_” + i].y = 10 * i; // ??This is the part that I can not do in Lua
}[/as3]
Thanks [import]uid: 44013 topic_id: 9798 reply_id: 309798[/import]
Your code is not enough to give you its lua counterpart but here’s a example:
[lua]local bots = { … } – your bots should be in this table
for i = 1, #bots do
bots[i].y = 10 * i;
end[/lua] [import]uid: 51516 topic_id: 9798 reply_id: 35683[/import]
@alberto1
when you get comfortable with Lua, you will realise that you could even do the this[“bot_” + i].y = 10*i easily in Lua.
However, seth has the solution for you.
cheers,
?
[import]uid: 3826 topic_id: 9798 reply_id: 35714[/import]
With simple lua classes http://lua-users.org/wiki/SimpleLuaClasses it could also look like:
var numBots:int = 10;
for i=1,numBots do
self["bot\_" + i].y = 10 \* i
end
[import]uid: 4596 topic_id: 9798 reply_id: 35738[/import]