Jump to content
  • Advertisement
Sign in to follow this  

[java] Preventing the same action from being performed too quickly?

This topic is 3163 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been using the LuaJava library to add lua scripting to my game. I had to add my own multithreading support: when a new script needs to be created, LuaMain.createScriptThread(source) is called, which creates a new thread of a ScriptThread object. The constructor of the ScriptThread creates a new LuaState (part of the library), the run() method executes the script. The library is kind of buggy though, if I create too many script threads quickly (rapidly clicking the Execute Command button, for example) then Java crashes (it is a native library.) I don't know C so I can't debug the library, but instead I want to limit the rate that new scripts can be made--if they are created too quickly, the extra ones are put in a queue and created one at a time. Simultaneous running is fine, but creating two threads at once is bad. How would I do this? Thanks.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!