luad allow preloading lua in parent process
if you have libaries that you require in every lua script, you can use this to load them when luad starts so that they are already there (and maybe sharing ram?) when clients connect.
This commit is contained in:
+12
@@ -115,6 +115,18 @@ fn main() -> std::io::Result<()> {
|
||||
};
|
||||
let lua = unsafe { Lua::unsafe_new() };
|
||||
|
||||
let mut argv = env::args();
|
||||
argv.next();
|
||||
|
||||
if let Some(prelude) = argv.next() {
|
||||
let path = Path::new(&prelude);
|
||||
println!("preloading {:?}", path);
|
||||
lua.load(path).exec().expect("load prelude failed");
|
||||
} else {
|
||||
println!("no preload");
|
||||
}
|
||||
|
||||
|
||||
let sock = UnixDatagram::bind(sock_path)?;
|
||||
|
||||
let mut peers : HashMap<i32, SocketAddr> = HashMap::new();
|
||||
|
||||
Reference in New Issue
Block a user