Can now use /CPL to reload lua source
This commit is contained in:
@@ -446,6 +446,25 @@ void SourceDB::init(lua_State *L) {
|
||||
}
|
||||
}
|
||||
|
||||
void SourceDB::serialize_source(const util::LuaSourceVec &sv, StreamBuffer *sb) {
|
||||
sb->write_int32(sv.size());
|
||||
for (const auto &pair : sv) {
|
||||
sb->write_string(pair.first);
|
||||
sb->write_string(pair.second);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceDB::deserialize_source(util::LuaSourceVec *sv, StreamBuffer *sb) {
|
||||
sv->clear();
|
||||
int count = sb->read_int32();
|
||||
if ((count < 0) || (count > 10000)) throw StreamCorruption();
|
||||
for (int i = 0; i < count; i++) {
|
||||
std::string fn = sb->read_string();
|
||||
std::string code = sb->read_string();
|
||||
sv->emplace_back(fn, code);
|
||||
}
|
||||
}
|
||||
|
||||
// These should go away eventually. They're for debugging.
|
||||
LuaDefine(coroutine_setnextid, "c") {
|
||||
LuaArg co, lid;
|
||||
|
||||
Reference in New Issue
Block a user