Stay organized with collections
Save and categorize content based on your preferences.
blockly > serialization > variables > VariableSerializer > save
serialization.variables.VariableSerializer.save() method
Serializes the variables of the given workspace.
Signature:
save(workspace: Workspace): IVariableState[] | null;
Parameters
Parameter |
Type |
Description |
workspace |
Workspace |
The workspace to save the variables of. |
Returns:
IVariableState[] | null
The state of the workspace's variables, or null if there are no variables.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[],["The `VariableSerializer.save()` method serializes a workspace's variables. It accepts a `Workspace` object as input and returns an array of `State` objects representing the serialized variables. If the workspace contains no variables, the method returns `null`. This method's core action is to capture the state of variables within a specified workspace and represent them in a serializable format.\n"]]