UserAccount3 Posted November 1, 2011 Posted November 1, 2011 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
Castillo Posted November 1, 2011 Posted November 1, 2011 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()
Charlie_Jefferson Posted November 1, 2011 Posted November 1, 2011 I suggest making a client and a server lua. If you do that, you can just addEvent in any of them and do triggerServerEvent or triggerClientEvent.
UserAccount3 Posted November 1, 2011 Author Posted November 1, 2011 Thankyou solidsnake14 i will try that tomorrow. Now i go to sleep its 01.20 here Good night all
Wojak Posted November 2, 2011 Posted November 2, 2011 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
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