Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Declare a method with a variable?

Is it possible to declare methods with a variable?

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

rather than

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

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.