PtokaX forum

Development Section => Your Developing Problems => Topic started by: TecMaster on 04 August, 2004, 12:09:21

Title: Calling fuctions in other scripts
Post by: TecMaster on 04 August, 2004, 12:09:21
How do I call a function, Test1(), in script file Test1.lua from a function, say Test2 in script file Test2.lua???
Title:
Post by: NightLitch on 04 August, 2004, 13:15:34
you put the two script togheter at the top of Test1.lua like this:



assert(dofile("Test2.lua"), "Test2.lua is not found")


hope this helps some...

/NL
Title:
Post by: TecMaster on 04 August, 2004, 16:18:12
But this would meen that the variables in the included Test2.lua would not be the same as the "stand alone" Test2.lua?
Title:
Post by: Herodes on 04 August, 2004, 18:10:45
u can still use any variables and any lua chunks if u assert a .lua file to another...

It is like attaching the lua code to the host-script...
Title:
Post by: TecMaster on 05 August, 2004, 14:09:55
Thanks, works fine  :)