|
@@ -1,5 +1,7 @@
|
|
|
// use std::{collections::HashMap, hash::Hash};
|
|
|
|
|
|
+use std::io::Cursor;
|
|
|
+
|
|
|
use ldb::LDb;
|
|
|
use buffer::Buffer;
|
|
|
use lua_shared as lua;
|
|
@@ -34,6 +36,20 @@ unsafe extern "C" fn gmod13_open(state: lua_State) -> i32 {
|
|
|
lua::pushstring(state, lua::cstr!("Sled 0.34.7"));
|
|
|
lua::setfield(state, -2, lua::cstr!("_VERSION"));
|
|
|
lua::setfield(state, lua::GLOBALSINDEX, lua::cstr!("sled"));
|
|
|
+ match lua::loadx(state, &mut Cursor::new(include_str!("lib.lua")), lua::cstr!("@includes/modules/lsled.lua"), lua::cstr!("t")) {
|
|
|
+ Ok(_) => match lua::pcall(state, 0, 0, 0) {
|
|
|
+ lua::Status::RuntimeError |
|
|
|
+ lua::Status::MemoryError |
|
|
|
+ lua::Status::Error => {lua::error(state);},
|
|
|
+ _ => {}
|
|
|
+ },
|
|
|
+ Err(lua::LError::MemoryError(e)) |
|
|
|
+ Err(lua::LError::SyntaxError(e)) => {
|
|
|
+ lua::pushlstring(state, e.as_ptr(), e.as_bytes().len());
|
|
|
+ lua::error(state);
|
|
|
+ },
|
|
|
+ _ => {}
|
|
|
+ }
|
|
|
0
|
|
|
}
|
|
|
|