Skip to content

Commit 0067cc1

Browse files
committed
Fixed a major bug and 2 small onces
1 parent f19147a commit 0067cc1

File tree

7 files changed

+1034
-324
lines changed

7 files changed

+1034
-324
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ UiPop()
6060
>![1.0.6](https://i.imgur.com/cH1XQrO.png)
6161
>![1.0.6](https://i.imgur.com/eLrd6vI.png)
6262
63+
### Release 1.3.6
64+
- Added back init, tick, update, draw functions
65+
- Added back all functions that don't have arguments
66+
6367
### Other
6468
> I did try doing this for Sublime Text 3 but it doesn't allow multiline descriptions so I don't see the point because you'll have to go to the teardown website (I made this so you don't have to do that)
6569

src/api.js

Lines changed: 18 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,31 @@ DOC = [...document.getElementsByClassName("function")].map((el) => {
4343

4444

4545
let args = arguments.match(paramregex);
46-
4746
if (args === null) args = "";
4847

4948
data = {
5049
info: args,
5150
dataType: arguments.match(dataType)
5251
}
5352

54-
if (!data.dataType) return
55-
const value = data.dataType
56-
57-
for (let i = 0; i < value.length; i++) {
58-
if (value[i] === '(string)') {
59-
args[i] = "'${" + args[i] + "}'"
60-
} else if (value[i] === '(table)') {
61-
args[i] = '(${' + args[i] + '})'
62-
} else {
63-
args[i] = '${' + args[i] + '}'
64-
}
65-
}
53+
const keyValue = (input) =>
54+
Object.entries(input).forEach(([key, value]) => {
55+
if (value == null) return
56+
57+
for (let i = 0; i < value.length; i++) {
58+
if (value) {
59+
if (value[i] === '(string)') {
60+
args[i] = "'${" + args[i] + "}'";
61+
} else if (value[i] === '(table)') {
62+
args[i] = '(${' + args[i] + '})';
63+
} else if (value[i] === '(number)') {
64+
args[i] = '${' + args[i] + '}';
65+
}
66+
}
67+
}
68+
})
69+
70+
keyValue(data);
6671

6772
innerObj = {
6873
scope: "lua",
@@ -71,79 +76,5 @@ DOC = [...document.getElementsByClassName("function")].map((el) => {
7176
description: `${arguments}\n\n${rets}\n\nFunction Information\n${funcInfo}\n\nExample\n${example}`
7277
};
7378

74-
return innerObj;
75-
}, {}).DOC = [...document.getElementsByClassName("function")].map((el) => {
76-
const name = el.innerText;
77-
el = el.nextElementSibling;
78-
79-
const def = el.innerText;
80-
el = el.nextElementSibling;
81-
82-
const optregex = /, optional\)$/;
83-
const argregex = /^\(([^,\)]*)/;
84-
const paramregex = /\w+(?=\s+\()/g;
85-
const dataType = /\((.*?)\)/g;
86-
87-
const mapper = arg => {
88-
const typea = arg.nextElementSibling;
89-
if (!typea || !typea.classList.contains("argtype")) return;
90-
return {
91-
name: arg.textContent,
92-
type: typea.textContent.match(argregex)[1],
93-
optional: optregex.test(typea.textContent),
94-
desc: typea.nextSibling.textContent.substr(3).trim(),
95-
param: typea.textContent.match(paramregex)[1]
96-
};
97-
};
98-
99-
const arguments = el.innerText;
100-
el = el.nextElementSibling;
101-
102-
const rets = el.innerText;
103-
el = el.nextElementSibling;
104-
105-
let funcInfo = el.innerText;
106-
el = el.nextElementSibling;
107-
108-
if (funcInfo === "") funcInfo = "none";
109-
110-
let info = '';
111-
while (!el.classList.contains('example')) {
112-
info = `${info}\n${el.textContent.trim()}`;
113-
el = el.nextElementSibling
114-
};
115-
116-
const example = el.innerText.trim();
117-
118-
119-
let args = arguments.match(paramregex);
120-
// file deepcode ignore ForEachReturns: <please specify a reason of ignoring this>
121-
if (args === null) args = "";
122-
123-
data = {
124-
info: args,
125-
dataType: arguments.match(dataType)
126-
}
127-
128-
if (!data.dataType) return
129-
const value = data.dataType
130-
131-
for (let i = 0; i < value.length; i++) {
132-
if (value[i] === '(string)') {
133-
args[i] = "'${" + args[i] + "}'"
134-
} else if (value[i] === '(table)') {
135-
args[i] = '(${' + args[i] + '})'
136-
} else {
137-
args[i] = '${' + args[i] + '}'
138-
}
139-
}
140-
141-
innerObj = {
142-
scope: "lua",
143-
body: `${name}(${args})`,
144-
prefix: name,
145-
description: `${arguments}\n\n${rets}\n\nFunction Information\n${funcInfo}\n\nExample\n${example}`
146-
};
147-
14879
return innerObj;
14980
}, {}).filter(notUndefined => notUndefined !== undefined)

0 commit comments

Comments
 (0)