I have this problem:
Items_groups[:curativos] = {
:items_ids => [1,7]
}
This is the hash im using. What i need is to acces to the array in a each loop.
Example:
search=''
Wep::Items_groups.each {|i,j| p i ; p j[0] ; p j.include?(item_id) ; search=i if j.include?(item_id)}
I also need to extract the key name as a string because i need it to acces another hash located in game system(to be saved).
I have been trying but without luck.
pd: the second problem is more simple :
I create an array with config hashes.
Blocker_slot_skills = []
Blocker_slot_skills[0] = {
:skill_id => 2,
:slot_num => 4,
:force => 50,
:block_pos => 77,
:rec_pos => 100
}
And iterate the array and i want to acces each hash:
for s in Wep::Blocker_slot_skills
p (s.is_a? (Hash)) , s, s["block_pos"], skill.id
I supose that s is a hash. It says true to is_a, s says the hash, but the s["block_pos"] gives nil.
Why?
Items_groups[:curativos] = {
:items_ids => [1,7]
}
This is the hash im using. What i need is to acces to the array in a each loop.
Example:
search=''
Wep::Items_groups.each {|i,j| p i ; p j[0] ; p j.include?(item_id) ; search=i if j.include?(item_id)}
I also need to extract the key name as a string because i need it to acces another hash located in game system(to be saved).
I have been trying but without luck.
pd: the second problem is more simple :
I create an array with config hashes.
Blocker_slot_skills = []
Blocker_slot_skills[0] = {
:skill_id => 2,
:slot_num => 4,
:force => 50,
:block_pos => 77,
:rec_pos => 100
}
And iterate the array and i want to acces each hash:
for s in Wep::Blocker_slot_skills
p (s.is_a? (Hash)) , s, s["block_pos"], skill.id
I supose that s is a hash. It says true to is_a, s says the hash, but the s["block_pos"] gives nil.
Why?