Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Declare a method with a variable?

Asked by 9 years ago

Is it possible to declare methods with a variable?

1local index = {}
2for x, r in pairs({'An','Example'}) do
3    index:[r] = function () end -- Doing this throws a syntax error
4end

rather than

1local index = {}
2function index:An () end
3function index:Example () end

1 answer

Log in to vote
1
Answered by
4Bros 550 Moderation Voter
9 years ago

You can't declare methods with a variable,

Ad

Answer this question