gpt4 book ai didi

脚本 : How do I save and restore a register?

转载 作者:行者123 更新时间:2023-12-05 09:20:10 27 4
gpt4 key购买 nike

如何保存寄存器的当前状态并在以后恢复它?

我想确保我的函数没有意外的副作用。

最佳答案

为了安全地执行此操作,您不仅需要恢复寄存器的内容,还需要恢复其类型:

let old_reg = getreg("a")               " Save the current content of register 'a'
let old_reg_type = getregtype("a") " Save the type of the register as well

" <Use the register 'a' as a temporary scratch pad here>

call setreg("a", old_reg, old_reg_type) " Restore register 'a'

关于脚本 : How do I save and restore a register?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38720452/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com