Running a function from a name in an array

I have an array and i want to go through it and then run them as a function:


powerups = {"Powerup_1","Powerup_2"}
for k,v in pairs(powerups) do
	moveUp = v()
end

But clearly this doesnt work as v isnt a function. Any ideas?

It may because you’re making the array with strings. Try: [lua]local powerups = { Powerup_1, Powerup_2 };[/lua]

[lua]
function Powerup_1()
return “svetahw”
end

function Powerup_2()
return “whatevs”
end

local funcs = {Powerup_2, Powerup_1}

for _,v in ipairs(funcs) do
local MoveUp = v()
end
[/lua]

Wow. I don’t know how I didn’t realize it was that simple. Thanks for helping me find how idiotic I am.