### Install rbxmk fish completions for new sessions Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/commands/completion/fish.html Installs the rbxmk fish completions for every new session. A new shell is required for the setup to take effect. ```fish rbxmk completion fish > ~/.config/fish/completions/rbxmk.fish ``` -------------------------------- ### select examples Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/base.html Shows how select returns arguments after a given index. The examples demonstrate indices 1 through 4, with index 4 returning no values. ```lua select(1, "A", "B", "C") --> "A", "B", "C" select(2, "A", "B", "C") --> "B", "C" select(3, "A", "B", "C") --> "C" select(4, "A", "B", "C") --> ``` -------------------------------- ### Install rbxmk with go install Source: https://github.com/anaminus/rbxmk/blob/imperative/README.md Installs the latest version of rbxmk using Go. Requires Go and Git to be installed. The binary is placed in $GOPATH/bin. ```bash go install github.com/anaminus/rbxmk/rbxmk@latest ``` -------------------------------- ### Install bash completions on Linux Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/commands/completion/bash.html Installs bash completions for rbxmk system-wide on Linux. A new shell is required for the setup to take effect. ```bash rbxmk completion bash > /etc/bash_completion.d/rbxmk ``` -------------------------------- ### Install bash completions on macOS Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/commands/completion/bash.html Installs bash completions for rbxmk system-wide on macOS. A new shell is required for the setup to take effect. ```bash rbxmk completion bash > /usr/local/etc/bash_completion.d/rbxmk ``` -------------------------------- ### Index Instance with Symbol to Access Metadata Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/sym.html Shows how to index an Instance with a symbol to set and get a metadata value, using sym.IsService as an example. The output is true. ```lua local instance = Instance.new("Workspace") instance[sym.IsService] = true print(instance[sym.IsService]) --> true ``` -------------------------------- ### CSV input example Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/formats/csv.html Example of CSV data that decodes into a two-dimensional array of strings. ```text A,B,C D,E,F G,H,I ``` -------------------------------- ### Configure build tags with -tags flag Source: https://github.com/anaminus/rbxmk/blob/imperative/INSTALL.md Configures build tags for the go install command. Replace 'tag1 tag2 etc' with the desired tags. ```bash go install -tags "tag1 tag2 etc" ``` -------------------------------- ### Build rbxmk from source Source: https://github.com/anaminus/rbxmk/blob/imperative/README.md Clones the rbxmk repository and installs the bleeding-edge version. The latest commit may not be production-ready. ```bash git clone https://github.com/anaminus/rbxmk cd rbxmk/rbxmk go install ``` -------------------------------- ### Set prerelease and build metadata with -X Source: https://github.com/anaminus/rbxmk/blob/imperative/INSTALL.md This example sets the prerelease to 'rc.1' and the build metadata to the current date and commit hash. The output of 'rbxmk version' shows the resulting version string. ```bash go install -ldflags="-X main.Prerelease=rc.1 -X main.Build=$(echo $(git log -1 --format=%cI | date --utc +%Y%m%d)-$(git rev-parse --short HEAD))" ``` ```bash rbxmk version # imperative-rc.1+20210312-2070bf8 ``` -------------------------------- ### Instance[sym.Properties] Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Symbol that gets or sets all properties of the instance. ```APIDOC ## [Symbol] Properties ### Description Gets or sets all properties of the instance. Each entry maps a property name to its value. When getting, properties that would produce an error are ignored. When setting, properties not in the table are removed; if any property could not be set, an error is thrown and no properties are set or removed. ### Symbol Properties ### Type table ``` -------------------------------- ### get Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/rbxmk.html Describes the get function from the rbxmk library. ```APIDOC ## get ### Description Gets the property of an instance. Uses the instance's descriptor if available; otherwise uses the fallback to determine the type. ### Parameters - **instance** (Instance) - Required - The instance whose property is being retrieved. - **property** (string) - Required - The name of the property to get. - **fallback** (string|Desc|nil) - Optional - Determines the type when the instance has no descriptor. If a string, it names the type; if a Desc, it uses that descriptor; if nil, the type is derived from the property value. ### Returns - The value of the property. ``` -------------------------------- ### Instance[sym.Reference] Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Symbol that gets or sets the reference of the instance. ```APIDOC ## [Symbol] Reference ### Description Gets or sets a string used to refer to the instance from within an instance tree. Certain formats use this to encode a reference to an instance. A reference should not be expected to persist when being encoded or decoded. ### Symbol Reference ### Type string ``` -------------------------------- ### Retrieve cookies from Studio session Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Uses Cookie.from to get a list of cookies from the user's Studio session. Returns a list of cookies. ```lua -- Returns a list of cookies. local cookies = Cookie.from("studio") ``` -------------------------------- ### Instance[sym.RawAttrConfig] Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Symbol that gets or sets the raw AttrConfig of the instance. ```APIDOC ## [Symbol] RawAttrConfig ### Description Gets or sets the raw AttrConfig of the instance, considering only the direct value of the current instance. ### Symbol RawAttrConfig ### Type AttrConfig ``` -------------------------------- ### Instance.ClassName Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Property that gets or sets the class of the instance. ```APIDOC ## [Property] ClassName ### Description Gets or sets the class of the instance. Can be modified except when the class is "DataModel". Changing the class has no additional effects. ### Property ClassName ### Type string ### Remarks - Cannot be set when the class is "DataModel". ``` -------------------------------- ### os.getenv Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/libraries.md Gets an environment variable, or all environment variables if no name is specified. ```APIDOC ## os.getenv ### Description Gets the value of the *name* environment variable, or nil if no such value is defined. If *name* is not specified, returns a table of environment variable names mapped to values. ### Method Function ### Signature `os.getenv(name: string?): string? | {[string]: string}` ### Parameters - **name** (string) - Optional - The name of the environment variable to get. ### Returns - **value** (string?) - The value of the environment variable, or nil if not found. - **table** ({[string]: string}) - If *name* is not specified, a table mapping environment variable names to values. ### Example ```lua local value = os.getenv("HOME") local all = os.getenv() ``` ``` -------------------------------- ### Instance[sym.AttrConfig] Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Symbol that gets or sets the AttrConfig used by the instance. ```APIDOC ## [Symbol] AttrConfig ### Description Gets or sets the AttrConfig used by the instance. AttrConfig is inherited. ### Symbol AttrConfig ### Type AttrConfig ``` -------------------------------- ### Instance[sym.RawDesc] Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Symbol that gets or sets the raw descriptor of the instance. ```APIDOC ## [Symbol] RawDesc ### Description Gets or sets the raw descriptor of the instance, considering only the direct value of the current instance. ### Symbol RawDesc ### Type Descriptor ``` -------------------------------- ### Instance[sym.Desc] Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Symbol that gets or sets the descriptor used by the instance. ```APIDOC ## [Symbol] Desc ### Description Gets or sets the descriptor used by the instance. Desc is inherited. ### Symbol Desc ### Type Descriptor ``` -------------------------------- ### List all fragments with rbxmk doc --recursive Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/commands/dump/fragments.html Lists all fragments, including those not referred to by the program. Use this to get a complete list of fragment references. ```bash rbxmk doc --recursive ``` -------------------------------- ### Cross-compile for Windows amd64 Source: https://github.com/anaminus/rbxmk/blob/imperative/INSTALL.md Set GOOS and GOARCH environment variables to cross-compile rbxmk for a different target system. This example targets Windows on amd64 architecture and includes the 'lang_no_default' and 'lang_en_us' build tags. ```bash GOOS=windows GOARCH=amd64 go install -tags "lang_no_default lang_en_us" ``` -------------------------------- ### Load bash completions for current session Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/commands/completion/bash.html Loads bash completions for rbxmk in the current shell session. Requires the 'bash-completion' package to be installed. ```bash source <(rbxmk completion bash) ``` -------------------------------- ### Instance.new Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Constructor for creating a new Instance. ```APIDOC ## [Instance] new ### Description Creates a new Instance of the given class. If a parent is specified, it sets the Parent property. If a descriptor is specified, it sets the Desc member and throws an error if the class does not exist. ### Method new ### Parameters - **className** (string) - Required - The class of the new Instance. - **parent** (Instance) - Optional - The parent of the new Instance. - **desc** (Descriptor) - Optional - The descriptor to use for the new Instance. ### Returns - **Instance** - The newly created Instance. ``` -------------------------------- ### Descend method example Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Searches for a descendant by recursively matching each name in succession, returning nil if a child is not found. Throws an error if no arguments are given. Provides a safe alternative to indexing children, which is not implemented by rbxmk. ```lua local face = game:Descend("Workspace", "Noob", "Head", "face") ``` -------------------------------- ### Create directory all: remodel.createDirAll vs fs.mkdir Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Shows the Remodel API remodel.createDirAll and its rbxmk equivalent using fs.mkdir with the second argument true to create parent directories as needed. ```lua remodel.createDirAll(path) ``` ```lua -- Second argument causes parent directories to be created as needed. fs.mkdir(path, true) ``` -------------------------------- ### Creating arbitrary class with Instance.new Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/README.md Demonstrates that any class can be created and the ClassName property can be assigned, since instances are just data. ```lua local foobar = Instance.new("Foobar") foobar.ClassName = "FizzBuzz" -- allowed ``` -------------------------------- ### Ray.Origin Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/ray.html Gets the position of the ray. ```APIDOC ## Ray.Origin ### Description The position of the ray. ### Field - **Origin** (Vector3) - The position of the ray. ``` -------------------------------- ### Ray.Direction Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/ray.html Gets the direction of the ray. ```APIDOC ## Ray.Direction ### Description The direction of the ray. ### Field - **Direction** (Vector3) - The direction of the ray. ``` -------------------------------- ### Keypoints Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/colorsequence.html Gets the keypoints of the sequence. ```APIDOC ## Keypoints ### Description Returns the ColorSequenceKeypoints of the sequence. ### Method Field ### Returns - **ColorSequenceKeypoints** - The keypoints of the sequence. ``` -------------------------------- ### Usage syntax for rbxmk run Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/commands/run.html Shows the general usage syntax for the run command. ```text [ FLAGS ] FILE [ VALUE... ] ``` -------------------------------- ### rbxmk help command syntax Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/README.md Displays help for a subcommand, or general usage if no subcommand is given. ```bash rbxmk help [ COMMAND ] ``` -------------------------------- ### NumberRange.Min Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/numberrange.html Gets the minimum value of the range. ```APIDOC ## NumberRange.Min ### Description The **Min** field returns the minimum possible value in the range. ### Returns - **number** - The minimum value of the range. ``` -------------------------------- ### Instance Methods Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/types.md Documentation for the Instance methods available in rbxmk, including Clone, Descend, Destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, and GetAttribute. ```APIDOC ## Instance:Clone() ### Description Returns a copy of the instance. Unlike in Roblox, Clone does not ignore an instance if its Archivable property is set to false. ### Method Instance method ### Endpoint Instance:Clone() ### Parameters None ### Returns - **Instance** (Instance) - A copy of the instance. ``` ```APIDOC ## Instance:Descend(names: ...[string]) ### Description Returns a descendant of the instance by recursively searching for each name in succession according to FindFirstChild. Returns nil if a child could not be found. Throws an error if no arguments are given. ### Method Instance method ### Endpoint Instance:Descend(names: ...[string]) ### Parameters - **names** (variadic string) - Required - The sequence of names to search for. ### Returns - **Instance** (Instance) - The found descendant, or nil if not found. ### Example ```lua local face = game:Descend("Workspace", "Noob", "Head", "face") ``` ``` ```APIDOC ## Instance:Destroy() ### Description Sets the Parent of the instance to nil. Unlike in Roblox, the Parent of the instance remains unlocked. Destroy also does not affect descendants. ### Method Instance method ### Endpoint Instance:Destroy() ### Parameters None ### Returns None ``` ```APIDOC ## Instance:FindFirstAncestor(name: string) ### Description Returns the first ancestor whose Name equals *name*, or nil if no such instance was found. ### Method Instance method ### Endpoint Instance:FindFirstAncestor(name: string) ### Parameters - **name** (string) - Required - The name to search for. ### Returns - **Instance** (Instance) - The first ancestor with the given name, or nil. ``` ```APIDOC ## Instance:FindFirstAncestorOfClass(className: string) ### Description Returns the first ancestor of the instance whose ClassName equals *className*, or nil if no such instance was found. ### Method Instance method ### Endpoint Instance:FindFirstAncestorOfClass(className: string) ### Parameters - **className** (string) - Required - The class name to search for. ### Returns - **Instance** (Instance) - The first ancestor with the given class name, or nil. ``` ```APIDOC ## Instance:FindFirstAncestorWhichIsA(className: string) ### Description Returns the first ancestor of the instance whose ClassName inherits *className* according to the instance's descriptor, or nil if no such instance was found. If the instance has no descriptor, then the ClassName is compared directly. ### Method Instance method ### Endpoint Instance:FindFirstAncestorWhichIsA(className: string) ### Parameters - **className** (string) - Required - The class name to check inheritance for. ### Returns - **Instance** (Instance) - The first ancestor that is of the given class or inherits it, or nil. ``` ```APIDOC ## Instance:FindFirstChild(name: string, recursive: bool?) ### Description Returns the first child of the instance whose Name equals *name*, or nil if no such instance was found. If *recursive* is true, then descendants are also searched, top-down. ### Method Instance method ### Endpoint Instance:FindFirstChild(name: string, recursive: bool?) ### Parameters - **name** (string) - Required - The name to search for. - **recursive** (bool) - Optional - If true, search descendants as well. ### Returns - **Instance** (Instance) - The first child with the given name, or nil. ``` ```APIDOC ## Instance:FindFirstChildOfClass(className: string, recursive: bool?) ### Description Returns the first child of the instance whose ClassName equals *className*, or nil if no such instance was found. If *recursive* is true, then descendants are also searched, top-down. ### Method Instance method ### Endpoint Instance:FindFirstChildOfClass(className: string, recursive: bool?) ### Parameters - **className** (string) - Required - The class name to search for. - **recursive** (bool) - Optional - If true, search descendants as well. ### Returns - **Instance** (Instance) - The first child with the given class name, or nil. ``` ```APIDOC ## Instance:FindFirstChildWhichIsA(className: string, recursive: bool?) ### Description Returns the first child of the instance whose ClassName inherits *className*, or nil if no such instance was found. If the instance has no descriptor, then the ClassName is compared directly. If *recursive* is true, then descendants are also searched, top-down. ### Method Instance method ### Endpoint Instance:FindFirstChildWhichIsA(className: string, recursive: bool?) ### Parameters - **className** (string) - Required - The class name to check inheritance for. - **recursive** (bool) - Optional - If true, search descendants as well. ### Returns - **Instance** (Instance) - The first child that is of the given class or inherits it, or nil. ``` ```APIDOC ## Instance:GetAttribute(attribute: string) ### Description Returns the value of *attribute*, or nil if the attribute is not found. This function uses the instance's sym.AttrConfig to select the property to decode from, which is expected to be string-like. An error is thrown if the data could not be decoded. ### Method Instance method ### Endpoint Instance:GetAttribute(attribute: string) ### Parameters - **attribute** (string) - Required - The name of the attribute to retrieve. ### Returns - **Variant** (Variant) - The value of the attribute, or nil if not found. ``` -------------------------------- ### NumberRange.Max Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/numberrange.html Gets the maximum value of the range. ```APIDOC ## NumberRange.Max ### Description The **Max** field returns the maximum possible value in the range. ### Returns - **number** - The maximum value of the range. ``` -------------------------------- ### string.byte Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/base/fields/string.html Gets the bytes of a string subset. ```APIDOC ## string.byte(s, i, j) ### Description Gets the bytes of a string subset. Returns the numerical byte codes of characters within `s` between `i` and `j`. ### Method Function ### Parameters - **s** (string) - Required - The string to get bytes from. - **i** (number) - Optional - The starting index (default 1). - **j** (number) - Optional - The ending index (default -1). ### Returns - **...** (number) - The byte codes of the characters in the specified range. ### Example ```lua string.byte("abc", 1, 2) -- returns 97, 98 ``` ``` -------------------------------- ### List all libraries in dump plugin Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/commands/dump/plugin.html Lists all libraries by iterating over dump.Libraries and writing each name followed by a newline. ```lua -- List all libraries. local dump, write = ... for _, library in ipairs(dump.Libraries) do write(library.Name, "\n") end ``` -------------------------------- ### Instance:Descend Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Method that gets a descendant by name. ```APIDOC ## [Method] Descend ### Description Returns a descendant of the instance by recursively searching for each name in succession according to FindFirstChild. Returns nil if a child could not be found. Throws an error if no arguments are given. ### Method Descend ### Parameters - **...names** (string) - Required - The names of the descendants to search for. ### Returns - **Instance** - The descendant instance, or nil if not found. ### Example ```lua local face = game:Descend("Workspace", "Noob", "Head", "face") ``` ``` -------------------------------- ### new Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/colorsequence.html Constructs a ColorSequence. Overloads: single color, two colors, or keypoints. ```APIDOC ## new ### Description Constructs a ColorSequence with a single color, two colors, or from keypoints. ### Method Constructor ### Parameters #### Overload 1: Single color - **color** (Color3) - Required - The color for the sequence. #### Overload 2: Two colors - **color0** (Color3) - Required - The first color. - **color1** (Color3) - Required - The second color. #### Overload 3: Keypoints - **keypoints** (Array) - Required - The keypoints of the sequence. Must be ordered ascending by Time, first Time 0, last Time 1. ### Returns - **ColorSequence** - The constructed sequence. ``` -------------------------------- ### Instance Methods Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Documentation for the Instance type methods: SetAttributes, index, and newindex. ```APIDOC ## SetAttributes ### Description Sets all attributes on the instance, replacing existing attributes with the provided map. Uses the instance's sym.AttrConfig to select the property to encode to. Throws an error if the data could not be encoded. ### Method SetAttributes ### Parameters #### attributes - **attributes** (map) - Required - A map of attribute names to values. ### Response No return value. Throws an error if encoding fails. ## index ### Description Gets the value of a property of the instance. If the instance has a descriptor, properties are enforced by the descriptor; otherwise, any property can be any type of value. ### Method index ### Parameters #### property - **property** (string) - Required - The name of the property to get. ### Response Returns the value of the property. ## newindex ### Description Sets the value of a property of the instance. If the instance has a descriptor, properties are enforced by the descriptor; otherwise, any property can be set to any value. ### Method newindex ### Parameters #### property - **property** (string) - Required - The name of the property to set. #### value - **value** (any) - Required - The value to set the property to. ### Response No return value. ``` -------------------------------- ### Instance.Parent Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Property that gets or sets the parent of the instance. ```APIDOC ## [Property] Parent ### Description Gets or sets the parent of the instance, which may be nil. ### Property Parent ### Type Instance ``` -------------------------------- ### Instance.Name Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Property that gets or sets the name of the instance. ```APIDOC ## [Property] Name ### Description Gets or sets a name identifying the instance. ### Property Name ### Type string ``` -------------------------------- ### Build release version with release tag Source: https://github.com/anaminus/rbxmk/blob/imperative/INSTALL.md Builds a release version by including the 'release' tag. The version output shows the release version number. ```bash go install -tags "release" rbxmk version # 0.5.1 ``` -------------------------------- ### Write existing place asset: remodel.writeExistingPlaceAsset vs rbxassetid.write Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Shows the Remodel API remodel.writeExistingPlaceAsset and its rbxmk equivalent using rbxassetid.write. The rbxmk version requires the REMODEL_AUTH environment variable for authentication. ```lua remodel.writeExistingPlaceAsset(game, "123456789") ``` ```lua -- Using REMODEL_AUTH environment variable for authentication. local auth = {Cookie.new(".ROBLOSECURITY", os.getenv("REMODEL_AUTH") or "")} rbxassetid.write({AssetId=123456789, Format="rbxl", Body=game}) ``` -------------------------------- ### fs.mkdir Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/fs.html Creates a new directory at the given path. If all is true, creates parent directories as needed. Returns true if all directories were created successfully, false if they already exist. ```APIDOC ## fs.mkdir ### Description Makes a new directory. If all is true, creates each parent directory as needed. Returns true if all directories were created successfully, false if all already exist. Throws an error if a problem occurred while creating a directory. ### Method Function ### Endpoint fs.mkdir(path, all?) ### Parameters - **path** (string) - Required - The path of the directory to create. - **all** (boolean) - Optional - If true, creates parent directories as needed. Defaults to false. ### Response #### Success Response Returns true if all directories were created successfully, false if all already exist. #### Error Response Throws an error if a problem occurred while creating a directory. ``` -------------------------------- ### Instance[sym.Metadata] Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Symbol that gets or sets the metadata of the DataModel. ```APIDOC ## [Symbol] Metadata ### Description Gets or sets the metadata associated with the DataModel. This member only exists if the instance is of class DataModel. ### Symbol Metadata ### Type any ``` -------------------------------- ### Write file: remodel.writeFile vs fs.write Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Shows the Remodel API remodel.writeFile and its rbxmk equivalent using fs.write with the "bin" format to write raw bytes. ```lua remodel.writeFile(path, content) ``` ```lua -- Write content to file as raw bytes. fs.write(path, content, "bin") ``` -------------------------------- ### Write place file: remodel.writePlaceFile vs fs.write Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Shows the Remodel API remodel.writePlaceFile and its rbxmk equivalent using fs.write. The rbxmk version accepts an Instance or array of Instances and supports implicit or explicit format. ```lua remodel.writePlaceFile(game, "file.rbxl") remodel.writePlaceFile(game, "file.rbxlx") ``` ```lua -- game may be an Instance or array of Instances. fs.write("file.rbxl", game) -- Implicit format from extension. fs.write("file.rbxlx", game) -- Implicit format from extension. fs.write("file.rbxl", game, "rbxl") -- Explicit format. fs.write("file.rbxlx", game, "rbxlx") -- Explicit format. ``` -------------------------------- ### Read file: remodel.readFile vs fs.read Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Shows the Remodel API remodel.readFile and its rbxmk equivalent using fs.read with the "bin" format to read raw bytes. ```lua local content = remodel.readFile(path) ``` ```lua -- Read raw content of file as raw bytes. local content = fs.read(path, "bin") ``` -------------------------------- ### Receive dump and write arguments Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/commands/dump/plugin.html The script receives a table describing the rbxmk Lua environment and a function to build output. ```lua local dump, write = ... ``` -------------------------------- ### index operator Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/enums.html Gets an Enum by name using the index operator. ```APIDOC ## index operator ### Description Gets an Enum by name using the index operator. ### Method index ### Parameters #### Index - **name** (string) - Required - The name of the Enum to retrieve. ### Response #### Success Response - **enum** (Enum) - The Enum with the specified name. #### Response Example ``` EnumValue ``` ``` -------------------------------- ### Display documentation for a topic reference Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/commands/doc.html Use the doc command with a reference to display documentation for a specific topic or section. The reference is case-insensitive for the topic portion and case-sensitive for sections. If the topic has no content but has sub-topics, those are listed instead. ```bash rbxmk doc types/Instance:Methods/FindFirstChild ``` -------------------------------- ### DescAction.Fields Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/descaction.html Gets all fields as a collection of field names mapped to values. ```APIDOC ## DescAction.Fields ### Description Gets all fields as a collection of field names mapped to values. ### Method Fields ### Returns - **fields** (table) - A collection of field names mapped to values. ``` -------------------------------- ### Set version variables with -X linker flag Source: https://github.com/anaminus/rbxmk/blob/imperative/INSTALL.md Use this command to pass version information to the Go linker. Replace $VARIABLE and $VALUE with the actual variable name and value. The main.Prerelease and main.Build variables are used to append prerelease and build metadata. ```bash go install -ldflags="-X $VARIABLE=$VALUE" ``` -------------------------------- ### DescAction.Field Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/descaction.html Gets the value of a field by name, or nil if the action has no such field. ```APIDOC ## DescAction.Field ### Description Gets the value of the _name_ field, or nil if the action has no such field. ### Method Field ### Parameters - **name** (string) - Required - The name of the field to get. ### Returns - **value** (any) - The value of the field, or nil if not present. ``` -------------------------------- ### Run a Lua script with rbxmk run Source: https://github.com/anaminus/rbxmk/blob/imperative/README.md Creates a simple Lua script and runs it with the rbxmk run subcommand. The output is shown as a comment after the command. ```bash echo 'print("Hello world!")' > hello-world.lua rbxmk run hello-world.lua # Hello world! ``` -------------------------------- ### Read place file: remodel.readPlaceFile vs fs.read Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Shows the Remodel API remodel.readPlaceFile and its rbxmk equivalent using fs.read. The rbxmk version supports implicit format from file extension or explicit format as a second argument. ```lua local game = remodel.readPlaceFile("file.rbxl") local game = remodel.readPlaceFile("file.rbxlx") ``` ```lua local game = fs.read("file.rbxl") -- Implicit format from extension. local game = fs.read("file.rbxlx") -- Implicit format from extension. local game = fs.read("file.rbxl", "rbxl") -- Explicit format. local game = fs.read("file.rbxlx", "rbxlx") -- Explicit format. ``` -------------------------------- ### getmetatable(v) Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/base.html Gets the metatable of a value. Returns nil if the value has no metatable. ```APIDOC ## getmetatable(v) ### Description Gets the metatable of v. Returns nil if v does not have a metatable. If the metatable has a __metatable field, its value is returned; otherwise, the metatable itself is returned. ### Parameters - **v** (any) - Required - The value whose metatable is to be retrieved. ### Returns - The metatable of v, or nil if none exists. ``` -------------------------------- ### _VERSION Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/base.html The current version of Lua. ```APIDOC ## _VERSION ### Description The current version of the Lua interpreter. The current value is "Lua 5.1". ``` -------------------------------- ### rbxmk.globalAttrConfig Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/libraries.md Gets or sets the global AttrConfig. Most items that utilize an AttrConfig will fallback to the global AttrConfig when possible. ```APIDOC ## rbxmk.globalAttrConfig ### Description Gets or sets the global AttrConfig. Most items that utilize an AttrConfig will fallback to the global AttrConfig when possible. ### Type field ### Signature `rbxmk.globalAttrConfig: AttrConfig?` ### Details - This field can be read or written. - See the Value inheritance section for details on how this field is inherited by Instances. ``` -------------------------------- ### DataModel[sym.Metadata] Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/types.md The DataModel[sym.Metadata] symbol gets or sets the metadata associated with the DataModel. This metadata is used by certain formats. ```APIDOC ## DataModel[sym.Metadata] ### Description The **Metadata** symbol gets or sets the metadata associated with the DataModel. This metadata is used by certain formats (e.g. ExplicitAutoJoints). ### Symbol `DataModel[sym.Metadata]: {[string]: string}` ### Type - **table** - A dictionary mapping string keys to string values. ``` -------------------------------- ### UDim2.new Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/udim2.html Returns a UDim2 composed from the components of each UDim. ```APIDOC ## UDim2.new ### Description Returns a UDim2 composed from the components of each UDim. ### Method Constructor ### Parameters - **xScale** (number) - Required - The X scale component. - **xOffset** (number) - Required - The X offset component. - **yScale** (number) - Required - The Y scale component. - **yOffset** (number) - Required - The Y offset component. ### Returns - **UDim2** - A UDim2 with the specified components. ``` -------------------------------- ### GetService Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/instance.html Returns a service instance from the DataModel, creating it if necessary. ```APIDOC ## GetService ### Description Returns the first child of the DataModel whose ClassName equals _className_. If no such child exists, then a new instance of _className_ is created. The Name of the instance is set to _className_, sym.IsService is set to true, and Parent is set to the DataModel. If the DataModel has a descriptor, then GetService will throw an error if the created class's descriptor does not have the "Service" tag set. ### Method Method ### Parameters - **className** (string) - Required - The class name of the service to get. ### Returns - Instance - The service instance. ``` -------------------------------- ### rbxmk.globalDesc Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/libraries.md Gets or sets the global root descriptor. Most items that utilize a root descriptor will fallback to the global descriptor when possible. ```APIDOC ## rbxmk.globalDesc ### Description Gets or sets the global root descriptor. Most items that utilize a root descriptor will fallback to the global descriptor when possible. ### Type field ### Signature `rbxmk.globalDesc: Desc?` ### Details - This field can be read or written. - See the Value inheritance section for details on how this field is inherited by Instances. ``` -------------------------------- ### Compile with sslkeylog tag Source: https://github.com/anaminus/rbxmk/blob/imperative/INSTALL.md Compiles with SSL key logging support. The linker sets main.sslKeyLogFileEnvVar to the name of an environment variable (e.g., SSLKEYLOGFILE) that points to the key logging file. Key logging is forced disabled when the 'release' tag is included. ```bash go install -tags "sslkeylog" -ldflags="-X main.sslKeyLogFileEnvVar=SSLKEYLOGFILE" ``` -------------------------------- ### remodel.readModelAsset Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Reads a Roblox model asset by its asset ID. In rbxmk, use rbxassetid.read and then GetChildren to get the model instances. ```APIDOC ## remodel.readModelAsset ### Description Reads a Roblox model asset by asset ID. ### Method N/A (Library function) ### Parameters - **assetId** (string) - Required - The asset ID of the model. ### Request Example ```lua local model = remodel.readModelAsset("123456789") ``` ### Response Returns the model instances. ### rbxmk Equivalent ```lua -- No authentication. local model = rbxassetid.read({AssetId=123456789, Format="rbxm"}):GetChildren() -- Using REMODEL_AUTH environment variable for authentication. local auth = {Cookie.new(".ROBLOSECURITY", os.getenv("REMODEL_AUTH") or "")} local model = rbxassetid.read({AssetId=123456789, Format="rbxm", Cookies=auth}):GetChildren() ``` ``` -------------------------------- ### remodel.getRawProperty Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Gets a property value from an instance without descriptor validation. In rbxmk, access the property directly, optionally disabling validation. ```APIDOC ## remodel.getRawProperty ### Description Gets a property value from an instance without descriptor validation. ### Method N/A (Library function) ### Parameters - **instance** (Instance) - Required - The instance to get the property from. - **property** (string) - Required - The name of the property. ### Request Example ```lua local value = remodel.getRawProperty(instance, "Property") ``` ### Response Returns the property value. ### rbxmk Equivalent ```lua -- Get property. May have descriptor validation depending on -- `instance[sym.Desc]`. local value = instance.Property -- Ensure validation is disabled. instance[sym.RawDesc] = false local value = instance.Property ``` ``` -------------------------------- ### os.getenv Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/os.html Documentation for the os.getenv function, an extension to the standard os library. ```APIDOC ## os.getenv ### Description Gets an environment variable. Returns the value of the _name_ environment variable, or nil if no such value is defined. If _name_ is not specified, then a table of environment variable names mapped to values is returned. ### Method Function ### Signature `os.getenv(name?)` ### Parameters - **name** (string) - Optional - The name of the environment variable to retrieve. If omitted, a table of all environment variables is returned. ### Returns - **string** - The value of the environment variable, or nil if not defined. - **table** - A table mapping environment variable names to values, when _name_ is not specified. ### Example ```lua local value = os.getenv("PATH") local all = os.getenv() ``` ``` -------------------------------- ### remodel.createDirAll Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Creates a directory and all parent directories as needed. In rbxmk, use fs.mkdir with the second argument set to true. ```APIDOC ## remodel.createDirAll ### Description Creates a directory and all parent directories as needed. ### Method N/A (Library function) ### Parameters - **path** (string) - Required - Path of the directory to create. ### Request Example ```lua remodel.createDirAll(path) ``` ### Response No return value. ### rbxmk Equivalent ```lua -- Second argument causes parent directories to be created as needed. fs.mkdir(path, true) ``` ``` -------------------------------- ### table.create Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/libraries.md Documentation for the table.create function. ```APIDOC ## table.create ### Description Creates a new table with a preallocated capacity and optionally fills each entry with a value. ### Method Function ### Signature `table.create(cap: number, value: any?): table` ### Parameters - **cap** (number) - Required - The capacity of the array part. - **value** (any) - Optional - The value to fill each entry with. ### Returns - **table** - The newly created table. ``` -------------------------------- ### Write existing model asset: remodel.writeExistingModelAsset vs rbxassetid.write Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Shows the Remodel API remodel.writeExistingModelAsset and its rbxmk equivalent using rbxassetid.write. The rbxmk version requires the REMODEL_AUTH environment variable for authentication. ```lua remodel.writeExistingModelAsset(instance, "123456789") ``` ```lua -- Using REMODEL_AUTH environment variable for authentication. local auth = {Cookie.new(".ROBLOSECURITY", os.getenv("REMODEL_AUTH") or "")} rbxassetid.write({AssetId=123456789, Format="rbxm", Body=instance}) ``` -------------------------------- ### table.create Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/table.html Creates a new table with a preallocated capacity. ```APIDOC ## table.create(cap, value) ### Description Creates a new table with a preallocated capacity. Each entry in the array is optionally filled with value. ### Parameters - **cap** (number) - Required - The capacity of the array part. - **value** (any) - Optional - The value to fill each entry with. ### Returns The newly created table. ``` -------------------------------- ### remodel.readModelFile Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Reads a Roblox model file (.rbxm or .rbxmx) and returns the model instances. In rbxmk, use fs.read and then GetChildren to get the top-level instances. ```APIDOC ## remodel.readModelFile ### Description Reads a Roblox model file and returns the model instances. ### Method N/A (Library function) ### Parameters - **file** (string) - Required - Path to the model file. ### Request Example ```lua local model = remodel.readPlaceFile("file.rbxm") ``` ### Response Returns a DataModel instance with top-level instances as children. ### rbxmk Equivalent ```lua -- Returns a DataModel instance with top-level instances as children. local model = fs.read("file.rbxm"):GetChildren() -- Implicit format from extension. local model = fs.read("file.rbxmx"):GetChildren() -- Implicit format from extension. local model = fs.read("file.rbxm", "rbxm"):GetChildren() -- Explicit format. local model = fs.read("file.rbxmx", "rbxmx"):GetChildren() -- Explicit format. ``` ``` -------------------------------- ### rbxmk run command syntax Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/README.md Shows the syntax for the run subcommand, which executes a Lua script file with optional value arguments. ```bash rbxmk run FILE [ VALUE... ] ``` -------------------------------- ### fs.stat Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/fs.html Gets metadata about a file. Returns a table with Name, IsDir, Size, and ModTime fields. Returns nil if the file does not exist. Does not follow symbolic links. ```APIDOC ## fs.stat ### Description Gets metadata of the given file. Returns a table with fields Name (string), IsDir (boolean), Size (number), and ModTime (number, Unix time). Returns nil if the file does not exist. Throws an error if a problem occurred while getting the metadata. Does not follow symbolic links. ### Method Function ### Endpoint fs.stat(path) ### Parameters - **path** (string) - Required - The path to the file to stat. ### Response #### Success Response Returns a table with: - **Name** (string) - The base name of the file. - **IsDir** (boolean) - Whether the file is a directory. - **Size** (number) - The size of the file, in bytes. - **ModTime** (number) - The modification time of the file, in Unix time. #### Error Response Returns nil if the file does not exist. Throws an error on other problems. ``` -------------------------------- ### Read place asset: remodel.readPlaceAsset vs rbxassetid.read Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/examples/remodel/README.md Shows the Remodel API remodel.readPlaceAsset and its rbxmk equivalent using rbxassetid.read. The rbxmk version can use no authentication or the REMODEL_AUTH environment variable with a Cookie. ```lua local game = remodel.readPlaceAsset("123456789") ``` ```lua -- No authentication. local game = rbxassetid.read({AssetId=123456789, Format="rbxl"}) -- Using REMODEL_AUTH environment variable for authentication. local auth = {Cookie.new(".ROBLOSECURITY", os.getenv("REMODEL_AUTH") or "")} local game = rbxassetid.read({AssetId=123456789, Format="rbxl", Cookies=auth}) ``` -------------------------------- ### types.some: Create Optional exprim from value Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/libraries.md Returns an Optional exprim with the type of the given value, encapsulating that value. The example assigns it to an attribute and prints the Value, which is a CFrame. ```lua local value = CFrame.new(1,2,3) model.WorldPivotData = types.some(value) -- type is Optional print(typeof(model.WorldPivotData.Value)) --> CFrame ``` -------------------------------- ### Color3.new Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/types/color3.html Constructs the zero Color3, with each component being zero, resulting in black. ```APIDOC ## Color3.new ### Description Returns the zero Color3. ### Method Constructor ### Parameters None. ### Returns - **Color3** - The zero Color3 (black). ``` -------------------------------- ### clipboard.read Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/libraries/clipboard.html The read function gets a value from the clipboard according to one of the given formats. It traverses formats and media types in order, selecting the first matching data and decoding it. ```APIDOC ## clipboard.read ### Description Gets data from the clipboard in one of a number of formats. Each format is traversed in order, and each media type within a format is traversed in order. The data that matches the first media type found in the clipboard is selected. This data is decoded by the format corresponding to the matched media type, and the result is returned. ### Parameters - **formats** (table) - Required - A list of formats to use for reading the clipboard. Each format has associated media types. ### Returns - The decoded value from the clipboard, or nil if no data was found. ### Errors - Throws an error if the value could not be decoded from the format, or if data could not be retrieved from the clipboard. ``` -------------------------------- ### Optional.some constructor usage Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/types.md Creates an Optional exprim that encapsulates the given value, inferring its type from the value. The example wraps a CFrame and shows that .Value returns the original CFrame. ```lua local value = CFrame.new(1,2,3) model.WorldPivotData = Optional.some(value) -- type is Optional print(typeof(model.WorldPivotData.Value)) --> CFrame ``` -------------------------------- ### rbxmk command syntax Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/README.md Shows the general syntax for invoking rbxmk with a subcommand and options. ```bash rbxmk COMMAND [ OPTIONS... ] ``` -------------------------------- ### Optional.none constructor usage Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/types.md Creates an empty Optional exprim of the given type. The example assigns Optional.none("CFrame") to model.WorldPivotData, resulting in a value of nil when accessed via .Value. ```lua model.WorldPivotData = Optional.none("CFrame") -- type is Optional print(typeof(model.WorldPivotData.Value)) --> nil ``` -------------------------------- ### Run dump plugin with script file Source: https://github.com/anaminus/rbxmk/blob/imperative/fragments/en-us/commands/dump/plugin.html Runs the specified Lua script as a dump format plugin. ```bash rbxmk dump plugin script.lua ``` -------------------------------- ### rbxmk version command Source: https://github.com/anaminus/rbxmk/blob/imperative/doc/README.md Displays the version of rbxmk, formatted according to semantic versioning. ```bash rbxmk version ```