File tree 1 file changed +47
-0
lines changed
1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ require "bundler/inline"
2
+
3
+ gemfile do
4
+ source "https://rubygems.org"
5
+
6
+ require "json"
7
+ require "pathname"
8
+
9
+ gem "pry"
10
+ end
11
+
12
+ BUILD_DIR = Pathname . new ( "build/" )
13
+ SRC_DIR = Pathname . new ( "src/" )
14
+
15
+ globals = JSON . parse ( ( BUILD_DIR + "globals.json" ) . read )
16
+
17
+ contents = [ ]
18
+ contents << "--[[EmmyLua]]"
19
+
20
+ globals . sort . each do |global , functions |
21
+ contents << ""
22
+ contents << "-- #{ global } :"
23
+ contents << ""
24
+ contents << "#{ global } = {}"
25
+ contents << ""
26
+
27
+ functions . each do |name , documentation |
28
+ contents << "---"
29
+
30
+ if documentation . key? "description"
31
+ contents << "--- #{ documentation [ "description" ] } "
32
+ contents << "---"
33
+ end
34
+ documentation [ "args" ] . each do |arg |
35
+ contents << "--- `#{ arg [ "name" ] } `#{ arg . key? ( "description" ) ? ": #{ arg [ "description" ] } " : "" } "
36
+ end
37
+ documentation [ "args" ] . each do |arg |
38
+ contents << "---@param #{ arg [ "name" ] } #{ arg . key? ( "type" ) ? " #{ arg [ "type" ] } " : "" } "
39
+ end
40
+
41
+ contents << "---@return #{ documentation [ "return_type" ] } #{ documentation . key? ( "return_description" ) ? " #{ documentation [ "return_description" ] } " : "" } " if documentation . key? "return_type"
42
+ contents << "function #{ global } .#{ name } (#{ documentation [ "args" ] . map { |arg | arg [ "name" ] } . join ( ", " ) } ) end"
43
+ contents << ""
44
+ end
45
+ end
46
+
47
+ puts contents . join ( "\n " )
You can’t perform that action at this time.
0 commit comments