Lua includes?

Started by
5 comments, last by Minsc 18 years, 8 months ago
Is it possible to include a script file into another script like you do in C++ with #include "myfile.h"? I have some functions that several scripts needs.
Advertisement
Not 100% sure but i think the function you need is called "import".

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

think theres a function called dofile in lua standard library.. check the documentation
----------Thale Cres
this: dofile( "filename" )
There's also the standard function:
require(filename)
Killers don't end up in jailThey end up on a high-score!
And I believe 'require' is the optimal way, since it will not perform re-definitions of things that have already been defined, for instance from the file/library already having been imported. For lots of modules, this can save time.
require workd great :) Thanks.

This topic is closed to new replies.

Advertisement