mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-21 19:45:10 +00:00
Documented manually created Lua functions
This commit is contained in:
parent
18a5ebafae
commit
f2247cd973
2 changed files with 168 additions and 3 deletions
|
@ -138,6 +138,90 @@ param_override_build['Vec3s'] = {
|
|||
|
||||
############################################################################
|
||||
|
||||
manual_index_documentation = """
|
||||
- manually written functions
|
||||
- [define_custom_obj_fields](#define_custom_obj_fields)
|
||||
- [network_init_object](#network_init_object)
|
||||
- [network_send_object](#network_send_object)
|
||||
|
||||
<br />
|
||||
|
||||
"""
|
||||
manual_documentation = """
|
||||
---
|
||||
# manually written functions
|
||||
|
||||
<br />
|
||||
|
||||
## [define_custom_obj_fields](#define_custom_obj_fields)
|
||||
|
||||
Defines a custom set of overlapping object fields. The `fieldTable` table's keys must start with the letter `o` and the values must be either `u32`, `s32`, or `f32`.
|
||||
|
||||
### Lua Example
|
||||
`define_custom_obj_fields({ oCustomField1 = 'u32', oCustomField2 = 's32', oCustomField3 = 'f32' })`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| fieldTable | `Lua Table` |
|
||||
|
||||
### C Prototype
|
||||
`N/A`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
## [network_init_object](#network_init_object)
|
||||
|
||||
Enables synchronization on an object.
|
||||
|
||||
- Setting `standardSync` to `true` will automatically synchronize the object at a rate that is determined based on player distance. The commonly used object fields will be automatically synchronized.
|
||||
- Setting `standardSync` to `false` will not automatically synchronize the object, or add commonly used object fields. The mod must manually call `network_send_object()` when fields have changed.
|
||||
|
||||
The `fieldTable` parameter can be `nil`, or a list of object fields.
|
||||
|
||||
### Lua Example
|
||||
`network_init_object(obj, true, { 'oCustomField1', 'oCustomField2', 'oCustomField3' })`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| object | [Object](structs.md#Object) |
|
||||
| standardSync | `bool` |
|
||||
| fieldTable | `Lua Table` |
|
||||
|
||||
### C Prototype
|
||||
`N/A`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [network_send_object](#network_send_object)
|
||||
|
||||
Sends a packet that synchronizes an object. This does not need to be called when `standardSync` is enabled.
|
||||
|
||||
The `reliable` field will ensure that the packet arrives, but should be used sparingly and only when missing a packet would cause a desync.
|
||||
|
||||
### Lua Example
|
||||
`network_send_object(obj, false)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| object | [Object](structs.md#Object) |
|
||||
| reliable | `bool` |
|
||||
|
||||
### C Prototype
|
||||
`N/A`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
"""
|
||||
|
||||
############################################################################
|
||||
|
||||
total_functions = 0
|
||||
header_h = ""
|
||||
|
||||
|
@ -408,6 +492,7 @@ def process_files():
|
|||
|
||||
def doc_function_index(processed_files):
|
||||
s = '# Supported Functions\n'
|
||||
s += manual_index_documentation
|
||||
for processed_file in processed_files:
|
||||
s += '- %s\n' % processed_file['filename']
|
||||
for function in processed_file['functions']:
|
||||
|
@ -451,7 +536,7 @@ def doc_function(function):
|
|||
|
||||
s += "\n### Lua Example\n"
|
||||
if rtype != None:
|
||||
s += "`local %sValue = %s(%s)`\n" % (rtype.replace('`', ''), fid, param_str)
|
||||
s += "`local %sValue = %s(%s)`\n" % (rtype.replace('`', '').split(' ')[0], fid, param_str)
|
||||
else:
|
||||
s += "`%s(%s)`\n" % (fid, param_str)
|
||||
|
||||
|
@ -503,6 +588,7 @@ def doc_functions(functions):
|
|||
def doc_files(processed_files):
|
||||
s = '## [:rewind: Lua Reference](lua.md)\n\n'
|
||||
s += doc_function_index(processed_files)
|
||||
s += manual_documentation
|
||||
for processed_file in processed_files:
|
||||
s += '\n---'
|
||||
s += '\n# functions from %s\n\n<br />\n\n' % processed_file['filename']
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
## [:rewind: Lua Reference](lua.md)
|
||||
|
||||
# Supported Functions
|
||||
|
||||
- manually written functions
|
||||
- [define_custom_obj_fields](#define_custom_obj_fields)
|
||||
- [network_init_object](#network_init_object)
|
||||
- [network_send_object](#network_send_object)
|
||||
|
||||
<br />
|
||||
|
||||
- behavior_table.h
|
||||
- [get_behavior_from_id](#get_behavior_from_id)
|
||||
- [get_id_from_behavior](#get_id_from_behavior)
|
||||
|
@ -670,6 +678,77 @@
|
|||
<br />
|
||||
|
||||
|
||||
---
|
||||
# manually written functions
|
||||
|
||||
<br />
|
||||
|
||||
## [define_custom_obj_fields](#define_custom_obj_fields)
|
||||
|
||||
Defines a custom set of overlapping object fields. The `fieldTable` table's keys must start with the letter `o` and the values must be either `u32`, `s32`, or `f32`.
|
||||
|
||||
### Lua Example
|
||||
`define_custom_obj_fields({ oCustomField1 = 'u32', oCustomField2 = 's32', oCustomField3 = 'f32' })`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| fieldTable | `Lua Table` |
|
||||
|
||||
### C Prototype
|
||||
`N/A`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
## [network_init_object](#network_init_object)
|
||||
|
||||
Enables synchronization on an object.
|
||||
|
||||
- Setting `standardSync` to `true` will automatically synchronize the object at a rate that is determined based on player distance. The commonly used object fields will be automatically synchronized.
|
||||
- Setting `standardSync` to `false` will not automatically synchronize the object, or add commonly used object fields. The mod must manually call `network_send_object()` when fields have changed.
|
||||
|
||||
The `fieldTable` parameter can be `nil`, or a list of object fields.
|
||||
|
||||
### Lua Example
|
||||
`network_init_object(obj, true, { 'oCustomField1', 'oCustomField2', 'oCustomField3' })`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| object | [Object](structs.md#Object) |
|
||||
| standardSync | `bool` |
|
||||
| fieldTable | `Lua Table` |
|
||||
|
||||
### C Prototype
|
||||
`N/A`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [network_send_object](#network_send_object)
|
||||
|
||||
Sends a packet that synchronizes an object. This does not need to be called when `standardSync` is enabled.
|
||||
|
||||
The `reliable` field will ensure that the packet arrives, but should be used sparingly and only when missing a packet would cause a desync.
|
||||
|
||||
### Lua Example
|
||||
`network_send_object(obj, false)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| object | [Object](structs.md#Object) |
|
||||
| reliable | `bool` |
|
||||
|
||||
### C Prototype
|
||||
`N/A`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
---
|
||||
# functions from behavior_table.h
|
||||
|
||||
|
@ -679,7 +758,7 @@
|
|||
## [get_behavior_from_id](#get_behavior_from_id)
|
||||
|
||||
### Lua Example
|
||||
`local Pointer <BehaviorScript>Value = get_behavior_from_id(id)`
|
||||
`local PointerValue = get_behavior_from_id(id)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
|
@ -699,7 +778,7 @@
|
|||
## [get_id_from_behavior](#get_id_from_behavior)
|
||||
|
||||
### Lua Example
|
||||
`local enum BehaviorIdValue = get_id_from_behavior(behavior)`
|
||||
`local enumValue = get_id_from_behavior(behavior)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
|
|
Loading…
Reference in a new issue