Send an unknown method call: Difference between revisions

lua again
m (promoted to task)
(lua again)
Line 102:
name = "foo";
example[name](5) # => 47</lang>
 
=={{header|Lua}}==
Don't forget to pass the object for methods!
<lang lua>local example = { }
function example:foo (x) return 42 + x end
 
local name = "foo"
example[name](example, 5) --> 47</lang>
 
=={{header|MATLAB}} / {{header|Octave}}==
9

edits