From 47810e5679145af5d9b43047dafdff453e09683a Mon Sep 17 00:00:00 2001 From: pixel Date: Mon, 28 May 2007 06:45:21 +0000 Subject: Adding small helper function to mass-load the lua support libs. --- include/loadlualibs.h | 8 ++++++++ lib/loadlualibs.cc | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 include/loadlualibs.h create mode 100644 lib/loadlualibs.cc diff --git a/include/loadlualibs.h b/include/loadlualibs.h new file mode 100644 index 0000000..d769a98 --- /dev/null +++ b/include/loadlualibs.h @@ -0,0 +1,8 @@ +#ifndef __LOADLUALIBS_H__ +#define __LOADLUALIBS_H__ + +#include + +void LoadLuaLibs(Lua * L); + +#endif diff --git a/lib/loadlualibs.cc b/lib/loadlualibs.cc new file mode 100644 index 0000000..7c1fefa --- /dev/null +++ b/lib/loadlualibs.cc @@ -0,0 +1,18 @@ +#include +#include + +extern unsigned int size_supportlib; +extern unsigned char supportlib[]; + +extern unsigned int size_tasklib; +extern unsigned char tasklib[]; + +void LoadLuaLibs(Lua * L) { + Buffer supportlib_buff; + supportlib_buff.write(supportlib, size_supportlib); + L->load(&supportlib_buff); + + Buffer tasklib_buff; + tasklib_buff.write(tasklib, size_tasklib); + L->load(&tasklib_buff); +} -- cgit v1.2.3