Equivalent of coroutine.yield(value) from rust ?
              
              #164
            
            
              
                
                  
                  
                    Answered
                  
                  by
                    tguichaoua
                  
              
          
                  
                    
                      tguichaoua
                    
                  
                
                  asked this question in
                Q&A
              
            -
| How to call / what is the equivalent of  | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            tguichaoua
          
      
      
        May 16, 2022 
      
    
    Replies: 2 comments
-
| Unfortunately you cannot yield from Rust code as Lua does not allow to yield across C-call boundary (which is applicable to Rust). | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| Since it's not possible to yield accros C-call boundary, I move my api into lua. function foo()
    local ud = _api.foo() -- call rust to create the userdata
    coroutine.yield(ud)
end | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        tguichaoua
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Since it's not possible to yield accros C-call boundary, I move my api into lua.