[LUA] Include like in C I have a big .lua file and I would like to split it into parts for convenience. Is there a way to make some sort of #include (like in C preprocessor?). I tried require and import but I'm getting "Attempt to call global 'require' (a nil value)". Basically, I have something like the code below and I would like to split it into several files and then call some sort of "main.lua" which includes all those. -- File 'variables.lua' VAR_1=64; VAR_2=65; -- File 'define1.lua' defineSomething(VAR_1,"text"); defineSomething(VAR_2,"text"); defineSomething(VAR_1,"text"); ... -- File 'define2.lua' defineSomething(VAR_2,"text"); defineSomething(VAR_2,"text"); defineSomething(VAR_1,"text"); ... -- File 'main.lua' #include 'variables.lua'; #include 'define1.lua' #include 'define1.lua' https://ift.tt/eA8V8J
I have a big .lua file and I would like to split it into parts for convenience. Is there a way to make some sort of #include (like in C preprocessor?). I tried require and import but I'm getting "Attempt to call global 'require' (a nil value)". Basically, I have something like the code below and I would like to split it into several files and then call some sort of "main.lua" which includes all those. -- File 'variables.lua' VAR_1=64; VAR_2=65; -- File 'define1.lua' defineSomething(VAR_1,"text"); defineSomething(VAR_2,"text"); defineSomething(VAR_1,"text"); ... -- File 'define2.lua' defineSomething(VAR_2,"text"); defineSomething(VAR_2,"text"); defineSomething(VAR_1,"text"); ... -- File 'main.lua' #include 'variables.lua'; #include 'define1.lua' #include 'define1.lua'
from GameDev.net http://bit.ly/2GiBLcP
from GameDev.net http://bit.ly/2GiBLcP
ليست هناك تعليقات