Aquaterion Posted December 12, 2016 Share Posted December 12, 2016 For example; I would like to know all possible functions of Light, AnimState, Transform, etc.. Link to comment Share on other sites More sharing options...
Cyberboy2000 Posted December 12, 2016 Share Posted December 12, 2016 (edited) Interesting question. As far as I know, there is no way for lua to know what an userdata actually is, since it is used to refer to things that are not defined within the lua language. However, it is possible to access that information from the opposite direction, by calling a function from inside the userdata that returns all other functions of the userdata. Unfortunately, that assumes that such a function exists in the first place, which is unlikely. There is a third option. Reflection. I don't remember specific functions but what reflection does is allow you to call a function without actually needing to know what that function is, access private functions, and other useful things. And one of those things is to find all functions and values of a class. A quick google should be all you need. Edit: I realised that not all languages support reflection. I don't know what engine DST uses but if it doesn't have a language that supports reflection then you're probably out of luck. Edit Edit: Actually, it should be possible to make an iterative function testing for every single possible function name (up to a limit) I'm going to take a look at that when I get home. Edited December 12, 2016 by Cyberboy2000 Link to comment Share on other sites More sharing options...
Aquaterion Posted December 12, 2016 Author Share Posted December 12, 2016 thanks for your time. I believe the DST engine is in C++? Link to comment Share on other sites More sharing options...
DarkXero Posted December 12, 2016 Share Posted December 12, 2016 for k, v in pairs(getmetatable(TheNet).__index) do print(k, v) end Use Find-in-Files to see usage and determine the arguments. Or you can guess them. Link to comment Share on other sites More sharing options...
Aquaterion Posted December 12, 2016 Author Share Posted December 12, 2016 6 minutes ago, DarkXero said: for k, v in pairs(getmetatable(TheNet).__index) do print(k, v) end Use Find-in-Files to see usage and determine the arguments. Or you can guess them. hmm don't think thats what I was looking for. I'm looking for engine component functions Link to comment Share on other sites More sharing options...
DarkXero Posted December 12, 2016 Share Posted December 12, 2016 Just now, Aquaterion said: hmm don't think thats what I was looking for. I'm looking for engine component functions for k, v in pairs(getmetatable(ThePlayer.AnimState).__index) do print(k, v) end Link to comment Share on other sites More sharing options...
Aquaterion Posted December 12, 2016 Author Share Posted December 12, 2016 4 minutes ago, DarkXero said: for k, v in pairs(getmetatable(ThePlayer.AnimState).__index) do print(k, v) end yep that's what I was looking for thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now