diff options
Diffstat (limited to 'libpanto-lua/src')
| -rw-r--r-- | libpanto-lua/src/module.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libpanto-lua/src/module.zig b/libpanto-lua/src/module.zig index 910334f..a707ecd 100644 --- a/libpanto-lua/src/module.zig +++ b/libpanto-lua/src/module.zig @@ -488,7 +488,8 @@ fn buildAgent(L: *c.lua_State, box: *AgentBox) ConfigError!void { ) catch return error.AgentInit; // Pin the store after Agent.init succeeds; the agent/session borrow it. - c.lua_pushvalue(L, -1); + // `luaL_ref` pops the store userdata, leaving the newly created Agent + // userdata on top for `agentNew` to return. box.store_ref = c.luaL_ref(L, LUA_REGISTRYINDEX); // Ownership of the inner conversation moved into the agent; neuter the |
