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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...