RosettaCodeData/Task/Reflection-List-methods/Lingo/reflection-list-methods-2.l...

12 lines
260 B
Plaintext

obj = script("MyClass").new()
put obj.handlers()
-- [#foo, #bar]
-- The returned list contains the object's methods ("handlers") as "symbols".
-- Those can be used like this to call the corresponding method:
call(#foo, obj)
-- "foo"
call(#bar, obj)
-- "bar"