Created
July 6, 2013 23:08
-
-
Save legumbre/5941619 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sequence_item_by_name(sequence_name, group_name, item_name) | |
local seqitem | |
if group_name then | |
local idx = table.find(sequences.arcade, function (k, v) return v.name == group_name end) | |
seqitem = table.find(sequences[sequence_name][idx], function (k, v) return type(v) == "table" and v.name == _(item_name) end) | |
if seqitem then | |
return group_name, seqitem | |
end | |
end | |
-- no group_name or the wrong one was given, try searching the level in ALL groups | |
for i, g in pairs(sequences[sequence_name]) do | |
seqitem = table.find(g, function (k, v) return type(v) == "table" and v.name == _(item_name) end) | |
if seqitem then | |
return g.name, seqitem | |
end | |
end | |
end | |
local LLL_sequence_name = 'arcade' | |
local LLL_group_name = 'reflection' | |
local LLL_item_name = 'boost_intro' | |
local LLL_item_idx = 1 | |
LLL_group_name, LLL_item_idx = sequence_item_by_name(LLL_sequence_name, LLL_group_name, LLL_item_name) | |
selected_next= { | |
sequence_name = LLL_sequence_name, | |
group_name = LLL_group_name, | |
item_idx = LLL_item_idx | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment