Jump to content

lua


001

Recommended Posts

In the wiki is also an introduction to scripting, along a function reference.
If you already have experience with any sort of scripting or programming you can probably just dive into it and do some small scripts to get the hang of the lua syntax.

Link to comment

Ideal way to learn Lua is to create small little scripts and start using some of the functions that are present in the Wiki. Learning the functions and seeing how they work is your foot into the door of scripting Lua. Once you get comfortable of these functions, you can then start to develop a mindset to the features you want to design. For example:

Bank System:

What do I need?

  • set/getAccountData
  • GUI (or commands?)
  • Validation technique (such as checking if the player has the correct amount of money before depositing, and vise-versa from the bank account)
  • ...

Hopefully this should help yah ;)

  • Like 1
Link to comment

You do not need to learn functions at all. Use wiki as reference and create scripts.  You just need to know the syntax well. Editing resources then re-creating them is a great way to learn basics and how to script. This will be slow but eventually you'll learn.

Note: Always indent your code.

  • Like 1
Link to comment
2 hours ago, Anubhav said:

You do not need to learn functions at all. Use wiki as reference and create scripts.  You just need to know the syntax well. Editing resources then re-creating them is a great way to learn basics and how to script. This will be slow but eventually you'll learn.

Note: Always indent your code.

You should at least get an overview of most of the functions and probably know the basic, much used stuff well enough to work with.
No one ever said you have to learn all the functions with what they return and all their arguments but if you have never heard of functions you will eventually try to solve problems that don't exist. e.g write functions in lua that are already native to MTA.

Also you should get a good editor with syntax highlighter and possibly auto completion, I suggest Atom (it has a mta lua plugin), that makes things a whole lot easier to read.

  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...