linking multiple lua files Thread last updated on 2007-12-19 20:40:13

Posted by member 106929 on 2007-12-18 04:23:02

sorry to be asking so many dumb questions but..

how do i link multiple lua files so that i can use a function from one file in another?

for example: ----
x.lua:
function x() lslua.message_box("hi") end

call_x.lua:
function wheres_x() x() end
-----------------

i guess i just can't figure out how to set up my files so that i can "require" them? i don't know..

thanks

Posted by member 93947 on 2007-12-19 20:11:38 link

put your files in a directory and set
*LuaScriptModuleDir
and you can require them

Posted by member 106929 on 2007-12-19 20:40:13 link

i actually didnt even need a require

apparently i can call functions from other files without needing to do anything except *LuaFile and making sure the function declaration isn't local (although im not sure why it didn't work before)

but thanks anyway :)