lolcatsareawesome Posted July 18, 2013 Share Posted July 18, 2013 Hi there again, I want to know if it's possible to call a function with his name as a string. Per example i have: function myFunctionName() end and in another part of my code, I've: local theFunction = "myFunctionName"; It's possible to call the function using theFunction() ? Thanks. Link to comment
DiSaMe Posted July 18, 2013 Share Posted July 18, 2013 All global variables are stored in the table _G with their names as keys. So myFunctionName is _G["myFunctionName"] Link to comment
lolcatsareawesome Posted July 18, 2013 Author Share Posted July 18, 2013 All global variables are stored in the table _G with their names as keys. So myFunctionName is _G["myFunctionName"] Oh thanks. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now