How to Invoke Function Given Function Name as String

This works using LUA only.

function FOO()  
 print(1,'FOO')  
end  
  
BAR = function()  
 print(2,'BAR')  
end  
  
function Invoke(f)  
 \_G[f]()  
end  
  
function Main()  
 Invoke('FOO')  
 f = 'BAR'  
 Invoke(f)  
end  
  
Main()  

OUTPUT

1 FOO  
2 BAR  

But when I try it using CORONA simulator, I get this error.
Runtime error
C:\Projects\Corona\T1\mrmc.lua:51: attempt to call field ‘FOO’ (a nil va
lue)

Anyone, any ideas? Thanks.
[import]uid: 68656 topic_id: 11410 reply_id: 311410[/import]

Problem resolved by restarting the simulator. [import]uid: 68656 topic_id: 11410 reply_id: 41364[/import]