summaryrefslogtreecommitdiff
path: root/PythonAPIDocumentation.md
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2021-11-15 16:28:45 -0500
committerPeter LaFosse <peter@vector35.com>2021-11-15 16:28:45 -0500
commit18e6ab5fc5f3a87876dd56d77484f03e7db96896 (patch)
tree77869cc36c508955b5c333fe86e8123e932bf0bd /PythonAPIDocumentation.md
parentfb0924a21fcc43f716524d172c7f64249d0e77fd (diff)
Fix broken example of using StructureBuilder
Diffstat (limited to 'PythonAPIDocumentation.md')
-rw-r--r--PythonAPIDocumentation.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/PythonAPIDocumentation.md b/PythonAPIDocumentation.md
index 1bd8e538..fd1f3a4d 100644
--- a/PythonAPIDocumentation.md
+++ b/PythonAPIDocumentation.md
@@ -194,14 +194,14 @@ struct Bas
As `Type` objects are immutable, the Binary Ninja API provides a pure python implementation of types to provide mutability, these all inherit from `MutableType` and keep the same names as their immutable counterparts minus the `Type` part. Thus `Structure` is the mutable version of `StructureType` and `Enumeration` is the mutable version of `MutableType`. `Type` objects can be converted to `MutableType` objects using the `Type.mutable_copy` API and, `MutableType` objects can be converted to `Type` objects through the `MutableType.immutable_copy` API. Generally speaking you shouldn't need the mutable type variants for anything except creation of structures and enumerations, mutable type variants are provided for convenience and consistency. Building and defining a new structure can be done in a few ways. The first way would be the two step process of creating the structure then defining it.
```python
-s = StructureBuilder(members=[(IntegerType.create(4), 'field_0')])
+s = StructureBuilder.create(members=[(IntegerType.create(4), 'field_0')])
bv.define_user_type('Foo', s)
```
A second option for more complicated situations you can opt for incremental initialization of the type:
```python
-s = StructureBuilder()
+s = StructureBuilder.create()
s.packed = True
s.append(IntegerType.create(2))
s.append(IntegerType.create(4))