hi how u doin? im just browsing now for table answers, almost like arrays but have few unique features which has got me confused. Try this link:
http://community.codemasters.com/forum/operation-flashpoint-dragon-rising-mission-editing-modding-chat-zone-123/394286-lua-tutorial-fun-tables.html
Let me know if its helped I think it has the answer. Got me started but im still stuck on getting my head around what is happening with this example:
bombDropTimes = {}
local interval = 1 / bombsThisLevel
for i = interval, 1, interval do
local dropTime = math.round(math.sin(i \* (math.pi / 2)) \* levelDuration)
print(dropTime)
bombDropTimes[#bombDropTimes + 1] = dropTime
end
Later used like this:
function checkForBombDrop()
if #bombDropTimes == 0 then
return
end
if frameCounter == bombDropTimes[1] then
table.remove(bombDropTimes, 1)
dropBomb()
end
end
For me its working but I dont understand how the table is being looped, I understand the dropBomb() triggering but not what its looking into e.g. its always checking == bombDropTimes[1]???
Sorry for hi jacking, just having table misunderstanding myself.
All help to uncover the mysteries welcome.
[import]uid: 118379 topic_id: 21039 reply_id: 83138[/import]