How do you use threads?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: How do you use threads?

Post by Robin »

bartbes wrote:I wonder how you guys fail to see it as easy as it is:
I didn't fail to see it, I just didn't know if zac wanted to use LÖVE.
Help us help you: attach a .love.
User avatar
Mud
Citizen
Posts: 98
Joined: Fri Nov 05, 2010 4:54 am

Re: How do you use threads?

Post by Mud »

bartbes wrote:I wonder how you guys fail to see [..] .thread.newThread("input", "input.lua")
I had no idea that existed. It's not in 0.6.2 and not included in the love module's index on the Wiki. Are you guys all using 0.7?
bartbes wrote:I have no idea why you would want to do this.
A simply console interface for debugging? That's what I assumed.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: How do you use threads?

Post by thelinx »

Mud wrote: I had no idea that existed. It's not in 0.6.2 and not included in the love module's index on the Wiki. Are you guys all using 0.7?
Yeah it's introduced in 0.7.0. It's on the wiki, just not in the sidebar.
A simply console interface for debugging? That's what I assumed.
debug.debug()
User avatar
Mud
Citizen
Posts: 98
Joined: Fri Nov 05, 2010 4:54 am

Re: How do you use threads?

Post by Mud »

debug.debug()
Ahh, very nice.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: How do you use threads?

Post by zac352 »

bartbes wrote: That being said, I have no idea why you would want to do this.
Because you need to receive command input from a user and run your server's physics and other services simultaneously... And doing that from a graphical input is not only laggy, but a pain to code...
Mud wrote:
debug.debug()
Ahh, very nice.
debug.debug() is almost identical to:

Code: Select all

debug=function()
while true do
local s=io.stdin:read()
if s=="cont" then break end
local f,e=loadstring(s)
assert(f,e)
assert(pcall(f))
end
end
But with a prompt. "lua_debug> "
Hello, I am not dead.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: How do you use threads?

Post by thelinx »

zac352 wrote:Because you need to receive command input from a user and run your server's physics and other services simultaneously... And doing that from a graphical input is not only laggy, but a pain to code...
You're writing a server in LÖVE? That doesn't sound very efficient to me.

You should just write it in pure Lua. I know I've seen a Box2D library for Lua somewhere...
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: How do you use threads?

Post by zac352 »

thelinx wrote:
zac352 wrote:Because you need to receive command input from a user and run your server's physics and other services simultaneously... And doing that from a graphical input is not only laggy, but a pain to code...
You're writing a server in LÖVE? That doesn't sound very efficient to me.

You should just write it in pure Lua. I know I've seen a Box2D library for Lua somewhere...
Why would I use box2d? We don't get along well. :roll:

And besides that, how do you use threads in regular lua? :o:
Hello, I am not dead.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: How do you use threads?

Post by thelinx »

You find a thread library for Lua. I don't know any off-hand, so try googling around.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: How do you use threads?

Post by zac352 »

thelinx wrote:You find a thread library for Lua. I don't know any off-hand, so try googling around.
The best thing I've found is POSIX only. >_<
Edit: I've found some stuff about "LuaThread", but I can't find any page for it. :huh:
Hello, I am not dead.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: How do you use threads?

Post by Robin »

Lua Lanes?
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 6 guests