[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Calling a member function using text to specify function name
- From: Robert Raschke <rtrlists@...>
- Date: Mon, 4 Jan 2010 20:01:03 +0000
On Mon, Jan 4, 2010 at 7:55 PM, Colm Sloan <firstname.lastname@example.org>
I'm trying to call a function, let's say it's called:
I'm trying to pass the name of the function as text where it can be later called. Here's what I've tried:
local functionName = 'MyClass.MyFunction01'
_G[ functionName ]()
I get the error:
I looked in the _G table and found that it does have the entry for my class and I'm sure my class has that function. Could anyone tell me what I'm doing wrong and how I can fix it?
my_class = 'MyClass'
my_fun = 'MyFunction01'