如何在Lua代码中进行无限循环? [英] How to make an infinite loop in Lua code?

查看:2142
本文介绍了如何在Lua代码中进行无限循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在内存中永远使用三个本地函数:

I have three local functions that I want to use forever in memory:

proxy:PlayerParamRecover();
proxy:PlayerRecover();
proxy:EnableInvincible(10000,true);

我不确定如何在无限循环中添加它们.

I'm not sure how to add them in an infinite loop.

推荐答案

您想要一个while循环:

while true do
  proxy:PlayerParamRecover()
  proxy:PlayerRecover()
  proxy:EnableInvincible(10000,true)
end

其他信息此处

请注意,由于while循环在进入该循环后将始终控制程序,因此您编写的任何代码将永远不会执行.无限循环仅在极端情况下有用-确保要执行的操作可以保证无限循环.

Note that, since the while loop will always have control of the program after entering that loop, any code you write after it won't ever execute. Infinite loops are only useful in extreme cases - make sure that what you want to do warrants it.

这篇关于如何在Lua代码中进行无限循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆