Hey guys,
Trying to fish around for documentation on lua methods and functions. I have already found the Oxide hooks but looking on other people's threads, they're using metamethods like player:StartSleeping()
Anywhere I'd be able to see a list of functions and methods? Or at least point me in the right direction?
Cheers,
Heroic
Solved List of functions and methods?
Discussion in 'Rust Development' started by HeroicHD, Jul 4, 2015.
-
Download Oxide 2 for experimental go to RustDedicated_data/Managed and there find a file named Assembly-CSharp.dll
Next step: Download a decompiler like "Telerik Decompiler" and open the dll listed above.
Next step: When you open it you can see everything what you can use in your plugin.
Note: Its not so easy to find what you want bcs there are many many things.
Next Step: Press CTRL+F and search for keywords like "Hurt" "Heal" "StartSleeping" "StopSleeping" "StartWounded(Not sure if its written like this)"
And also search here for configs timer data tables and other stuff http://docs.oxidemod.org/rust/ -
Hey PaiN,
Thank you very much for your reply. I have followed until the end, and I have another question.
So I've found these player method things (http://i.imgur.com/AWIQIHw.png) (whatever you call this stuff in C# c: ). So do I just say something like:
Code:local IsPlayerAsleep = player:isSleeping()
Also, if I were to switch to developing in c#, would it be much easier to make a plugin? I'm only using Lua as I have previous experience with it in Garrys Mod but unlike Rust, GMod provides an abundance of documentation.
Cheers,
Heroic -
If you want to check if player is sleeping you will probably have to do it like
LUA:
Code:local IsSleeping = player:isSleeping()if not IsSleeping then --do something end
Code:var IsSleeping = player.isSleeping();if(!IsSleeping) // if not player is sleeping { //Do something }
and then switch to C# when you know good lua.
-
Great, thanks for the examples!
Would you say that C# is a much more functional language (can you do more with C# than you can do Lua)?
Cheers,
Heroic -
C# is more powerful and some things are a bit easier to reach because its the same language the game is coded in.
Lua is still very good and probably 98% of the people wont ever reach the point where they want to do something that isnt possible with lua, its just a bit more complicated sometimes
I'd say both languages are relatively easy to learn but c# harder to master and you'll find more examples to learn from in lua than in c#. -
Great! I might just stick with Lua then, haha.
Thanks so much for your input guys. Helped me out a lot.
Cheers,
Heroic -
-
The biggest advantage of C# is that you can use it in Visual Studio and have contextual help. You can even decompile the whole rust assembly and use it as a project in VS to look for stuff, it's a lot more intuitive than decompiling on-the-fly using a decompiler and you'll find a lot more stuff and ways to use them.
The base of the language is pretty simple, but most C# example you'll find will use LINQ and other stuff that might be a bit confusing to the uninitiated. It's just a matter of taking the time to look at examples, some documentation and with time you'll get good.
I disagree with the statement that there are more LUA examples, this was true back in legacy but I find that most mods I download are C# for Rust 2.0... Out of about 30 plugins I've downloaded as examples to look through, only 4-5 are python or LUA, rest is all C#... and I didn't pick them because they were C#, just happened like that.