Jump to content

Run a function in another lua file but within same resource?


UserAccount3

Recommended Posts

Hello guys !! I need info on how to run another finction in otjer lua file but within same resource.

Like thjis: i have a file called client1.lua and client2.lua both are clientside. Now the client1.lua has function named openInputWindow and i need to execute tjhat finction from client2.lua. How to do this?

P.S Sorry my typos, i writed this from ann iphone :D

Link to comment

Well, just execute it, if you haven't defined the function as local, then should work.

If you want to execute a function from a resource to another then export it with:

-- meta.xml:

function="functionName" type="functionType" /> 

and then from the other resource you can do:

exports["resourceName"]:functionName() 

Link to comment

all global variables (including functions) are shared between all the files of the same side within a resource so if you craete a function in client1.lua there should be no problem with calling it in client2.lua

exports are for sharing functions between resources

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...