Luau vectors
            
            #140
          
          
        -
| 
         I'm testing the new Luau support for native vectors in  let lua = Lua::new();
let x: mlua::Function = lua
    .load("return function(v) print(v) end")
    .call(())
    .unwrap();
x.call::<_, ()>(mlua::Value::Vector(1.0, 2.0, 3.0));But I can't create native vectors on the Lua side. The documentation suggests it's   | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            khvzak
          
      
      
        Mar 29, 2022 
      
    
    Replies: 1 comment 7 replies
-
| 
         The constructor indeed is not provided by Luau, you need to do something like:     let globals = lua.globals();
    globals.set(
        "vector",
        lua.create_function(|_, (x, y, z)| Ok(Value::Vector(x, y, z)))?,
    )?; | 
  
Beta Was this translation helpful? Give feedback.
                  
                    7 replies
                  
                
            
      Answer selected by
        setzer22
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
The constructor indeed is not provided by Luau, you need to do something like: