tovector

tovector(str: string) : vector|nil

Creates a vector from a string argument in format <1,1,1>

Invalid strings will return nil

Caveat

Due to an old error from lsl strings that match upto the closing > are interpreted as valid

So <1,1,1, <1,1,1,1 and <1,1,1spoon are all cast to <1,1,1>

When testing if a string is a quaternion or a vector, you should test with toquaternion first.

Example

tovector('test')
{
  "def": "func",
  "name": "tovector",
  "energy": 0,
  "pure": true,
  "sleep": 0,
  "signatures": [
    {
      "result": [
        {
          "name": "",
          "def": "result",
          "desc": "",
          "variadic": false,
          "type": [
            "vector",
            "nil"
          ],
          "optional": false
        }
      ],
      "args": [
        {
          "def": "arg",
          "name": "str",
          "desc": "string to create vector from",
          "type": [
            "string"
          ],
          "variadic": false,
          "optional": false
        }
      ]
    }
  ],
  "desc": "Creates a vector from a string argument in format `<1,1,1>`\n\nInvalid strings will return `nil`\n\n#### Caveat\n\nDue to an old error from lsl strings that match upto the closing `>` are interpreted as valid\n\nSo `<1,1,1`, `<1,1,1,1` and `<1,1,1spoon` are all cast to `<1,1,1>`\n\nWhen testing if a string is a quaternion or a vector, you should test with `toquaternion` first.",
  "link": ""
}

< Back to SLua