Hello,
i;m trying create menu for my simple lua scripts which creats subchannels but i have var in my functions.
function cc(serverConnectionHandlerID,x) where x is number of sub channels it create. I totaly don;t know how to make a menu for my script, event don;t know how it should looks like in files etc, can someone help me?
optionally I can copy and do some different functions without condition with different amounts each

Code:
require("ts3init")

function cc(serverConnectionHandlerID, x)
for i = 1, x do
	local clientID, error = ts3.getClientID(serverConnectionHandlerID)
	if error ~= ts3errors.ERROR_ok then
		print("Failed to get ClientID: " .. error)
		return
	end
	
	local parentChannelID, error = ts3.getChannelOfClient(serverConnectionHandlerID, clientID)
	if error ~= ts3errors.ERROR_ok then
		print("Error getting parent ChannelID: "  .. error)
		return
	end

	ts3.setChannelVariableAsString(
		serverConnectionHandlerID, 0,
		ts3defs.ChannelProperties.CHANNEL_NAME,
		i)
	ts3.setChannelVariableAsString(
		serverConnectionHandlerID, 0,
		ts3defs.ChannelProperties.CHANNEL_FLAG_PERMANENT,
		1)
	ts3.setChannelVariableAsString(
		serverConnectionHandlerID, 0,
		ts3defs.ChannelProperties.CHANNEL_CODEC,
		4)
	ts3.setChannelVariableAsString(
		serverConnectionHandlerID, 0,
		ts3defs.ChannelProperties.CHANNEL_CODEC_QUALITY,
		6)

	local error = ts3.flushChannelCreation(
		serverConnectionHandlerID,
		parentChannelID)
	if error ~= ts3errors.ERROR_ok then
		print("Error creating channel: "  .. error)
		return
	end
end
end
or just few functions like.. for 3 channels..
Code:
require("ts3init")

function cc3(serverConnectionHandlerID)
for i = 1, 3 do
	local clientID, error = ts3.getClientID(serverConnectionHandlerID)
	if error ~= ts3errors.ERROR_ok then
		print("Failed to get ClientID: " .. error)
		return
	end
	
	local parentChannelID, error = ts3.getChannelOfClient(serverConnectionHandlerID, clientID)
	if error ~= ts3errors.ERROR_ok then
		print("Error getting parent ChannelID: "  .. error)
		return
	end

	ts3.setChannelVariableAsString(
		serverConnectionHandlerID, 0,
		ts3defs.ChannelProperties.CHANNEL_NAME,
		i)
	ts3.setChannelVariableAsString(
		serverConnectionHandlerID, 0,
		ts3defs.ChannelProperties.CHANNEL_FLAG_PERMANENT,
		1)
	ts3.setChannelVariableAsString(
		serverConnectionHandlerID, 0,
		ts3defs.ChannelProperties.CHANNEL_CODEC,
		4)
	ts3.setChannelVariableAsString(
		serverConnectionHandlerID, 0,
		ts3defs.ChannelProperties.CHANNEL_CODEC_QUALITY,
		6)

	local error = ts3.flushChannelCreation(
		serverConnectionHandlerID,
		parentChannelID)
	if error ~= ts3errors.ERROR_ok then
		print("Error creating channel: "  .. error)
		return
	end
end
end