Finish implementing LUA_PROBE
This commit is contained in:
@@ -31,11 +31,12 @@ eng::string Invocation::debug_string() const {
|
|||||||
oss << "inv[";
|
oss << "inv[";
|
||||||
switch (kind_) {
|
switch (kind_) {
|
||||||
case InvocationKind::INVALID: oss << "invalid"; break;
|
case InvocationKind::INVALID: oss << "invalid"; break;
|
||||||
case InvocationKind::LUA_CALL: oss << "lua_call"; break;
|
case InvocationKind::LUA_INVOKE: oss << "lua_invoke"; break;
|
||||||
case InvocationKind::LUA_EXPR: oss << "lua"; break;
|
case InvocationKind::LUA_PROBE: oss << "lua_probe"; break;
|
||||||
|
case InvocationKind::LUA_EXPR: oss << "lua_expr"; break;
|
||||||
|
case InvocationKind::LUA_SOURCE: oss << "lua_source"; break;
|
||||||
case InvocationKind::FLUSH_PRINTS: oss << "flush_prints"; break;
|
case InvocationKind::FLUSH_PRINTS: oss << "flush_prints"; break;
|
||||||
case InvocationKind::TICK: oss << "tick"; break;
|
case InvocationKind::TICK: oss << "tick"; break;
|
||||||
case InvocationKind::LUA_SOURCE: oss << "lua_source"; break;
|
|
||||||
default: oss << "UNKNOWN"; break;
|
default: oss << "UNKNOWN"; break;
|
||||||
}
|
}
|
||||||
oss << " a=" << actor_;
|
oss << " a=" << actor_;
|
||||||
|
|||||||
@@ -247,7 +247,16 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void event_call_function(InvocationKind kind, int64_t place_id, std::string_view datapk, StreamBuffer *retpk) override {
|
virtual void event_call_function(InvocationKind kind, int64_t place_id, std::string_view datapk, StreamBuffer *retpk) override {
|
||||||
delayed_invocations_.emplace_back(kind, actor_id_, place_id, datapk);
|
switch (kind) {
|
||||||
|
case InvocationKind::LUA_PROBE: {
|
||||||
|
world_to_asynchronous();
|
||||||
|
world_->probe_lua_call(actor_id_, place_id, datapk, retpk);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
delayed_invocations_.emplace_back(kind, actor_id_, place_id, datapk);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void event_update() override {
|
virtual void event_update() override {
|
||||||
|
|||||||
@@ -194,7 +194,17 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void event_call_function(InvocationKind kind, int64_t place_id, std::string_view datapk, StreamBuffer *retpk) override {
|
virtual void event_call_function(InvocationKind kind, int64_t place_id, std::string_view datapk, StreamBuffer *retpk) override {
|
||||||
delayed_invocations_.emplace_back(kind, admin_id_, place_id, datapk);
|
switch (kind) {
|
||||||
|
case InvocationKind::LUA_PROBE: {
|
||||||
|
master_->snapshot();
|
||||||
|
master_->probe_lua_call(admin_id_, place_id, datapk, retpk);
|
||||||
|
master_->rollback();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
delayed_invocations_.emplace_back(kind, admin_id_, place_id, datapk);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void event_update() override {
|
virtual void event_update() override {
|
||||||
|
|||||||
@@ -700,7 +700,7 @@ void World::run_unittests() {
|
|||||||
|
|
||||||
void World::invoke(const Invocation &inv) {
|
void World::invoke(const Invocation &inv) {
|
||||||
switch (inv.kind()) {
|
switch (inv.kind()) {
|
||||||
case InvocationKind::LUA_CALL:
|
case InvocationKind::LUA_INVOKE:
|
||||||
invoke_lua_call(inv.actor(), inv.place(), inv.datapack());
|
invoke_lua_call(inv.actor(), inv.place(), inv.datapack());
|
||||||
break;
|
break;
|
||||||
case InvocationKind::LUA_EXPR:
|
case InvocationKind::LUA_EXPR:
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ function bechar()
|
|||||||
makeclass("engio")
|
makeclass("engio")
|
||||||
function engio.myfunction(actor, place, a, b, c)
|
function engio.myfunction(actor, place, a, b, c)
|
||||||
print("Myfunction actor=", actor," place=", place)
|
print("Myfunction actor=", actor," place=", place)
|
||||||
pprint("A:", a)
|
print("A:", a)
|
||||||
pprint("B:", b)
|
print("B:", b)
|
||||||
pprint("C:", c)
|
print("C:", c)
|
||||||
return {13, "chicken", {2,3,4}, false}
|
return {13, "chicken", {2,3,4}, false}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user