Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Dec 21, 2024
2 parents 4da0fa8 + c6b8917 commit 21607a4
Show file tree
Hide file tree
Showing 37 changed files with 828 additions and 242 deletions.
64 changes: 58 additions & 6 deletions docs/game_data/spel2.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ def print_lf(lf):
[] if type_name not in ps.constructors else ps.constructors[type_name]
)
for var in ctors + type["vars"]:
if "comment" in var and "NoDoc" in var["comment"]:
if "comment" in var and var["comment"] and "NoDoc" in var["comment"]:
continue
var_name = var["name"]
search_link = (
Expand Down
13 changes: 9 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4680,7 +4680,7 @@ <h3 id='get_entity_name'>get_entity_name</h3>
<p>Search script examples for <a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=get_entity_name">get_entity_name</a></p>
</blockquote>
<h4 id='string-get_entity_name-ENT_TYPE-type-optional-fallback_strategy'>string get_entity_name(<a href="#ENT_TYPE">ENT_TYPE</a> type, optional<bool> fallback_strategy)</h4>
<p>Get localized name of an entity, pass <code>fallback_strategy</code> as <code>true</code> to fall back to the <code>ENT_TYPE.*</code> enum name
<p>Get localized name of an entity from the journal, pass <code>fallback_strategy</code> as <code>true</code> to fall back to the <code>ENT_TYPE.*</code> enum name
if the entity has no localized name</p>
<h3 id='get_entity_type'>get_entity_type</h3>
<blockquote>
Expand All @@ -4698,7 +4698,7 @@ <h3 id='get_local_players'>get_local_players</h3>
<blockquote>
<p>Search script examples for <a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=get_local_players">get_local_players</a></p>
</blockquote>
<h4 id='nil-get_local_players'>nil get_local_players()</h4>
<h4 id='vector-lt-Player-gt-get_local_players'>vector&lt;<a href="#Player">Player</a>&gt; get_local_players()</h4>
<p>Get the thread-local version of players</p>
<h3 id='get_player'>get_player</h3>
<blockquote>
Expand Down Expand Up @@ -5223,13 +5223,13 @@ <h3 id='get_local_prng'>get_local_prng</h3>
<blockquote>
<p>Search script examples for <a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=get_local_prng">get_local_prng</a></p>
</blockquote>
<h4 id='nil-get_local_prng'>nil get_local_prng()</h4>
<h4 id='PRNG-get_local_prng'><a href="#PRNG">PRNG</a> get_local_prng()</h4>
<p>Get the thread-local version of prng</p>
<h3 id='get_local_state'>get_local_state</h3>
<blockquote>
<p>Search script examples for <a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=get_local_state">get_local_state</a></p>
</blockquote>
<h4 id='nil-get_local_state'>nil get_local_state()</h4>
<h4 id='StateMemory-get_local_state'><a href="#StateMemory">StateMemory</a> get_local_state()</h4>
<p>Get the thread-local version of state</p>
<h3 id='get_ms'>get_ms</h3>
<blockquote>
Expand Down Expand Up @@ -17709,6 +17709,11 @@ <h3 id='StateMemory'>StateMemory</h3>
<td><a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=room_owners">room_owners</a></td>
<td>Holds info about owned rooms and items (shops, challenge rooms, vault etc.)</td>
</tr>
<tr>
<td>any</td>
<td><a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=user_data">user_data</a></td>
<td>You can store a table (or lua primitive) here and it will store data correctly in online multiplayer, by having a different copy on each state and being copied over when the game does.<br/>Doesn&#39;t support recursive tables / cyclic references. Metatables will be transferred by reference instead of being copied<br/></td>
</tr>
</tbody></table>
<h2 id='Texture-types'>Texture types</h2><h3 id='TextRenderingInfo'>TextRenderingInfo</h3>
<table><thead>
Expand Down
13 changes: 9 additions & 4 deletions docs/light.html
Original file line number Diff line number Diff line change
Expand Up @@ -4680,7 +4680,7 @@ <h3 id='get_entity_name'>get_entity_name</h3>
<p>Search script examples for <a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=get_entity_name">get_entity_name</a></p>
</blockquote>
<h4 id='string-get_entity_name-ENT_TYPE-type-optional-fallback_strategy'>string get_entity_name(<a href="#ENT_TYPE">ENT_TYPE</a> type, optional<bool> fallback_strategy)</h4>
<p>Get localized name of an entity, pass <code>fallback_strategy</code> as <code>true</code> to fall back to the <code>ENT_TYPE.*</code> enum name
<p>Get localized name of an entity from the journal, pass <code>fallback_strategy</code> as <code>true</code> to fall back to the <code>ENT_TYPE.*</code> enum name
if the entity has no localized name</p>
<h3 id='get_entity_type'>get_entity_type</h3>
<blockquote>
Expand All @@ -4698,7 +4698,7 @@ <h3 id='get_local_players'>get_local_players</h3>
<blockquote>
<p>Search script examples for <a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=get_local_players">get_local_players</a></p>
</blockquote>
<h4 id='nil-get_local_players'>nil get_local_players()</h4>
<h4 id='vector-lt-Player-gt-get_local_players'>vector&lt;<a href="#Player">Player</a>&gt; get_local_players()</h4>
<p>Get the thread-local version of players</p>
<h3 id='get_player'>get_player</h3>
<blockquote>
Expand Down Expand Up @@ -5223,13 +5223,13 @@ <h3 id='get_local_prng'>get_local_prng</h3>
<blockquote>
<p>Search script examples for <a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=get_local_prng">get_local_prng</a></p>
</blockquote>
<h4 id='nil-get_local_prng'>nil get_local_prng()</h4>
<h4 id='PRNG-get_local_prng'><a href="#PRNG">PRNG</a> get_local_prng()</h4>
<p>Get the thread-local version of prng</p>
<h3 id='get_local_state'>get_local_state</h3>
<blockquote>
<p>Search script examples for <a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=get_local_state">get_local_state</a></p>
</blockquote>
<h4 id='nil-get_local_state'>nil get_local_state()</h4>
<h4 id='StateMemory-get_local_state'><a href="#StateMemory">StateMemory</a> get_local_state()</h4>
<p>Get the thread-local version of state</p>
<h3 id='get_ms'>get_ms</h3>
<blockquote>
Expand Down Expand Up @@ -17709,6 +17709,11 @@ <h3 id='StateMemory'>StateMemory</h3>
<td><a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=room_owners">room_owners</a></td>
<td>Holds info about owned rooms and items (shops, challenge rooms, vault etc.)</td>
</tr>
<tr>
<td>any</td>
<td><a href="https://github.com/spelunky-fyi/overlunky/search?l=Lua&amp;q=user_data">user_data</a></td>
<td>You can store a table (or lua primitive) here and it will store data correctly in online multiplayer, by having a different copy on each state and being copied over when the game does.<br/>Doesn&#39;t support recursive tables / cyclic references. Metatables will be transferred by reference instead of being copied<br/></td>
</tr>
</tbody></table>
<h2 id='Texture-types'>Texture types</h2><h3 id='TextRenderingInfo'>TextRenderingInfo</h3>
<table><thead>
Expand Down
31 changes: 18 additions & 13 deletions docs/parse_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,13 +685,18 @@ def run_parse():
cpp_type = type[2]
name = type[3]
attr = type[4]
extra_comments = {}
if container:
extra = []
n = re.findall(
r"(?<! NoDoc )" + container + r'\[([\w":]+)\] = ([^;]+);', data
r'(/// [\w _\-+<>.,`"\'=]*?)?' + container + r'\[([\w":]+)\] = ([^;]+);', data
)
for var in n:
extra.append(",".join(var))
if var[0].startswith("/// NoDoc"):
continue
if var[0]:
extra_comments[var[1].replace('"', '')] = var[0][4:]
extra.append(",".join(var[1:3]))
extra = ",".join(extra)
if attr:
attr = attr + "," + extra
Expand Down Expand Up @@ -749,11 +754,9 @@ def run_parse():
var[1] = var[1][:-1]

var_name = var[0]
cpp = replace_fun(
var[1]
) # should probably be done later, so the regex doesn't have to relay on some of the changes, also generate_emmylua.py uses some unique formats replacements
cpp = replace_fun(var[1]) #TODO: should probably be done later, so the regex doesn't have to relay on some of the changes, also generate_emmylua.py uses some unique formats replacements

if var[1].startswith("sol::property"):
if var[1].startswith("sol::property"): # fix for sol::property
param_match = re.match(
rf"property\(\[\]\({underlying_cpp_type['name']}&(\w+)\)",
cpp,
Expand Down Expand Up @@ -785,10 +788,8 @@ def run_parse():
"comment": fun["comment"],
}
)
elif cpp.startswith("[]("):
param_match = re.match(
r"\[\]\(([\w &<>\?*:,]+)?\) -> ([\w.*&<>\?\[\]:]+)?(?: )?{", cpp
)
elif cpp.startswith("[]("): # lambdas
param_match = re.match(r"\[\]\(([\w <>\?&*:,]+)?\) -> ([\w.*&<>\?\[\]:]+)?(?: )?{", cpp)
if param_match:
ret = param_match.group(2)
if ret is None:
Expand All @@ -808,7 +809,7 @@ def run_parse():
"name": var_name,
"type": cpp,
"signature": f"{ret} {var_name}({sig})",
"comment": "",
"comment": [extra_comments[var_name]] if var_name in extra_comments else [],
"function": True,
"cb_signature": "",
}
Expand All @@ -827,6 +828,8 @@ def run_parse():
if fun["comment"]
else None
)
if var_name in extra_comments:
fun["comment"].append(extra_comments[var_name])

vars.append(
{
Expand Down Expand Up @@ -861,6 +864,8 @@ def run_parse():
sig += underlying_cpp_var["name"][
underlying_cpp_var["name"].find("[") :
]
if var_name in extra_comments:
underlying_cpp_var["comment"].append(extra_comments[var_name])
vars.append(
{
"name": var_name,
Expand All @@ -877,10 +882,10 @@ def run_parse():
type = replace_fun(m_return_type[1])
sig = f"{type} {var_name}"
vars.append(
{"name": var_name, "type": cpp, "signature": sig}
{"name": var_name, "type": cpp, "signature": sig, "comment": [extra_comments[var_name]] if var_name in extra_comments else []}
)
else:
vars.append({"name": var_name, "type": cpp})
vars.append({"name": var_name, "type": cpp, "comment": [extra_comments[var_name]] if var_name in extra_comments else []})

if name in vtables_by_usertype:
vtable = vtables_by_usertype[name]
Expand Down
1 change: 1 addition & 0 deletions docs/src/includes/_enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,7 @@ Name | Data | Description
Name | Data | Description
---- | ---- | -----------
[DTOR](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=RENDER_INFO_OVERRIDE.DTOR) | 0 |
[DRAW](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=RENDER_INFO_OVERRIDE.DRAW) | 1 |
[RENDER](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=RENDER_INFO_OVERRIDE.RENDER) | 3 |

## REPEAT_TYPE
Expand Down
Loading

0 comments on commit 21607a4

Please sign in to comment.