Jump to content

Is Lua.LuaDoString using a lock?


Recommended Posts

Hey @Droidz

is Lua.LuaDoString using a lock? I'm trying to figure something out.
When I lock frames, my entire combat iterations works very fast. When I don't freeze them, it's very slow (about 8 times slower, even when putting a lock on ObjectManager.Locker).
I have optimized my framework quite a lot in recent times and still don't understand why things can take as long as they do sometimes. 
I thought it might have something to do with me utilizing multi threading.

Just trying to understand wRobot better and I happen to use a lot of Lua instead of reading from memory directly.

Link to comment
Share on other sites


(when you don't use lock frame) Lua is slow because WRobot need to inject code in wow (that run in next frame refresh). If you call 5 times lua (on 1 thread) you need to wait ~5 wow frames, ~80ms with 60 fps.

You can:

- lockframe (it is a easier way, and in some case better)

- avoid to use lua (but a lot of wrobot api methods use lua it is hard to know what methods you can use or not)

- try to avoid useless lua call (by sample if you use "if (lua.do("is ok") && me.health < 10 && me.havetarget)" replace it by "if (me.havetarget && me.health < 10 && lua.do("is ok"))"

- combine your lua scripts (if you use several lua calls in one condition try to combine it to one call)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...