mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Merge branch 'master' of https://github.com/ElunaLuaEngine/Eluna
This commit is contained in:
@@ -326,7 +326,15 @@ void Eluna::report(lua_State* L)
|
|||||||
void Eluna::ExecuteCall(lua_State* L, int params, int res)
|
void Eluna::ExecuteCall(lua_State* L, int params, int res)
|
||||||
{
|
{
|
||||||
int top = lua_gettop(L);
|
int top = lua_gettop(L);
|
||||||
luaL_checktype(L, top - params, LUA_TFUNCTION);
|
int type = lua_type(L, top - params);
|
||||||
|
|
||||||
|
if (type != LUA_TFUNCTION)
|
||||||
|
{
|
||||||
|
lua_pop(L, params + 1); // Cleanup the stack.
|
||||||
|
ELUNA_LOG_ERROR("[Eluna]: Cannot execute call: registered value is a %s, not a function.", lua_typename(L, type));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (lua_pcall(L, params, res, 0))
|
if (lua_pcall(L, params, res, 0))
|
||||||
report(L);
|
report(L);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ if __name__ == '__main__':
|
|||||||
"""Returns a function that parses content for refs to other classes, methods, or enums,
|
"""Returns a function that parses content for refs to other classes, methods, or enums,
|
||||||
and automatically inserts the correct link.
|
and automatically inserts the correct link.
|
||||||
"""
|
"""
|
||||||
# Make a list of all class names and method names.
|
# Make lists of all class names and method names.
|
||||||
class_names = []
|
class_names = []
|
||||||
method_names = []
|
method_names = []
|
||||||
|
|
||||||
@@ -96,23 +96,36 @@ if __name__ == '__main__':
|
|||||||
content = ''
|
content = ''
|
||||||
|
|
||||||
for token in tokens:
|
for token in tokens:
|
||||||
if token in class_names:
|
# Ignore tokens that don't start with "&".
|
||||||
# Take the "&" off the front of the class's name.
|
if not token.startswith('&'):
|
||||||
class_name = token[len('&'):]
|
content += token + ' '
|
||||||
url = '{}{}/index.html'.format(('../' * level), class_name)
|
continue
|
||||||
token = '<a class="mod" href="{}">{}</a>'.format(url, class_name)
|
|
||||||
|
|
||||||
elif token in method_names:
|
# Try to find a matching class.
|
||||||
# Take the "amp;" off the front of the method's name.
|
for class_name in class_names:
|
||||||
full_name = token[len('&'):]
|
if token.startswith(class_name):
|
||||||
# Split "Class:Method" into "Class" and "Method".
|
# Take the "&" off the front of the token and class's name.
|
||||||
class_name, method_name = full_name.split(':')
|
token = token[len('&'):]
|
||||||
url = '{}{}/{}.html'.format(('../' * level), class_name, method_name)
|
class_name = class_name[len('&'):]
|
||||||
token = '<a class="fn" href="{}">{}</a>'.format(url, full_name)
|
url = '{}{}/index.html'.format(('../' * level), class_name)
|
||||||
|
token = '<a class="mod" href="{}">{}</a>'.format(url, token)
|
||||||
|
break
|
||||||
|
|
||||||
|
# No matching class, try to find a method.
|
||||||
|
else:
|
||||||
|
for method_name in method_names:
|
||||||
|
if token.startswith(method_name):
|
||||||
|
# Take the "amp;" off the front of the token.
|
||||||
|
full_name = token[len('&'):]
|
||||||
|
# Split "Class:Method" into "Class" and "Method".
|
||||||
|
class_name, method_name = method_name.split(':')
|
||||||
|
url = '{}{}/{}.html'.format(('../' * level), class_name, method_name)
|
||||||
|
token = '<a class="fn" href="{}">{}</a>'.format(url, full_name)
|
||||||
|
break
|
||||||
|
|
||||||
content += token + ' '
|
content += token + ' '
|
||||||
|
|
||||||
return content
|
return content[:-1] # Strip off the last space.
|
||||||
|
|
||||||
# Links to the "Programming in Lua" documentation for each Lua type.
|
# Links to the "Programming in Lua" documentation for each Lua type.
|
||||||
lua_type_documentation = {
|
lua_type_documentation = {
|
||||||
|
|||||||
@@ -43,9 +43,11 @@ class ParameterDoc(object):
|
|||||||
self.description += '<p><em>Valid numbers</em>: all decimal numbers.</p>'
|
self.description += '<p><em>Valid numbers</em>: all decimal numbers.</p>'
|
||||||
|
|
||||||
self.data_type = 'number'
|
self.data_type = 'number'
|
||||||
|
|
||||||
elif self.data_type == 'bool':
|
elif self.data_type == 'bool':
|
||||||
self.data_type = 'boolean'
|
self.data_type = 'boolean'
|
||||||
elif self.data_type == 'uint64':
|
|
||||||
|
elif self.data_type == 'uint64' or self.data_type == 'int64':
|
||||||
self.data_type = 'string'
|
self.data_type = 'string'
|
||||||
|
|
||||||
|
|
||||||
@@ -108,16 +110,16 @@ class ClassParser(object):
|
|||||||
body_regex = re.compile(r"\s*\s?\*\s*(.*)") # The "body", i.e. a * and optionally some descriptive text.
|
body_regex = re.compile(r"\s*\s?\*\s*(.*)") # The "body", i.e. a * and optionally some descriptive text.
|
||||||
# An extra optional space (\s?) was thrown in to make it different from `class_body_regex`.
|
# An extra optional space (\s?) was thrown in to make it different from `class_body_regex`.
|
||||||
|
|
||||||
param_regex = re.compile(r"""\s*\*\s@param\s # The @param tag starts with opt. whitespace followed by "* @param ".
|
param_regex = re.compile(r"""\s*\*\s@param\s # The @param tag starts with opt. whitespace followed by "* @param ".
|
||||||
([&\w]+)\s(\w+) # The data type, a space, and the name of the param.
|
([&\w]+)\s(\w+) # The data type, a space, and the name of the param.
|
||||||
(?:\s=\s(.-))? # The default value: a = surrounded by spaces, followed by text.
|
(?:\s=\s(\w+))? # The default value: a = surrounded by spaces, followed by text.
|
||||||
(?:\s:\s(.+))? # The description: a colon surrounded by spaces, followed by text.""",
|
(?:\s:\s(.+))? # The description: a colon surrounded by spaces, followed by text.
|
||||||
re.X)
|
""", re.X)
|
||||||
|
|
||||||
# This is the same as the @param tag, minus the default value part.
|
# This is the same as the @param tag, minus the default value part.
|
||||||
return_regex = re.compile(r"""\s*\*\s@return\s
|
return_regex = re.compile(r"""\s*\*\s@return\s
|
||||||
([&\w]+)\s(\w+)
|
([&\w]+)\s(\w+)
|
||||||
(?:\s:\s(.+))?""", re.X)
|
(?:\s:\s(.+))?
|
||||||
|
""", re.X)
|
||||||
|
|
||||||
comment_end_regex = re.compile(r"\s*\*/") # The end of the comment portion, i.e. */
|
comment_end_regex = re.compile(r"\s*\*/") # The end of the comment portion, i.e. */
|
||||||
end_regex = re.compile(r"\s*int\s(\w+)\s*\(") # The end of the documentation, i.e. int MethodName(
|
end_regex = re.compile(r"\s*int\s(\w+)\s*\(") # The end of the documentation, i.e. int MethodName(
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
{%- if current_method.parameters|length > 0 %}
|
{%- if current_method.parameters|length > 0 %}
|
||||||
{%- for param in current_method.parameters %}
|
{%- for param in current_method.parameters %}
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>{{ param.data_type|escape|parse_data_type }} {{ param.name }} {{ param.default_value + ' ' if param.default_value }}</code></dt>
|
<dt><code>{{ param.data_type|escape|parse_data_type }} {{ param.name }} {{- ' (' + param.default_value + ')' if param.default_value }}</code></dt>
|
||||||
<dd class="docblock">{{ param.description|parse_links if param.description else '<em>See method description.</em>' }}</dd>
|
<dd class="docblock">{{ param.description|parse_links if param.description else '<em>See method description.</em>' }}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user