How to list all functions and fields in userdata #481
              
                Unanswered
              
          
                  
                    
                      lammermann
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment
-
| The best way to do this is to honestly have each userdata implement an __iter metatable (or whatever your Lua uses for this) | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys,
I try to build a REPL with mlua and rustyline.
When it comes to tab-completion I check if the current prompt could be completed by using the method
for_eachfrom the tables. For example given the current promptfoo.bit searches the lua globals forfooand then searches all fields infooand filters to only those beginning withbthen returningbarandbazas possible completions.This works fine for tables but I could not find something similar for userdata ( I found the method
pairsin theUserDataMetatablebut it does not seem to return the name of the functions of the userdata).Is there any advice how to get this information from userdata?
Thanks in advance for any hints
Beta Was this translation helpful? Give feedback.
All reactions