Use more LUA files (require)

Recommended Posts

Hello there!

I just started to develop some fun scripts to the MTA SA (1.5.6) 

Im not a professional LUA programmer but as good i see on forums (stack overflow etc.) there is a way to import or use functions from other lua files with "require"

My problem is that the "require" isnt working for me and i cant import functions from other lua file.I will not paste code because i tried every possible combinations of using the "require"

Is there some way to use functions from other file? can i use "require" or there is a alternative for it?

Thank you for your answrs 😊

Share this post

Link to post

The require function is disabled in MTA. Every script in your meta.xml shares the same global table _G, you don't have to import any scripts. If you define a global function in one script, it will be available in the other script - but you can't call functions directly on client/server from server/client respectively, you would have to use events.

Share this post

Link to post

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.