diff options
Diffstat (limited to 'funcsignature.etlua')
| -rw-r--r-- | funcsignature.etlua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/funcsignature.etlua b/funcsignature.etlua new file mode 100644 index 0000000..48d92ba --- /dev/null +++ b/funcsignature.etlua @@ -0,0 +1,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 %>
+)
|
