aboutsummaryrefslogtreecommitdiff
path: root/funcsignature.etlua
blob: 48d92ba1f5577f484148a0d884affe38b9ccf274 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<% assert(func, "Requires function to render a function signature") %>
<% assert(funcname, "Requires a function name to render a function signature") %>
<a href="#<%- funcname %>"><%- funcname %></a>(
	<% if func.params and #func.params > 0 then %>
		<% local optchain = false %>
		<% for paramid, param in pairs(func.params) do %>
			<% if paramid == 1 and param.optional then %>
				[
			<% elseif param.optional then %>
				[,
			<% elseif paramid > 1 then %>
				,
			<% end %>
			<%- param.name %>
			<% if paramid == 1 and param.optional then %>
				]
			<% elseif param.optional then %>
				]
			<% end %>
		<% end %>
	<% end %>
)