Page 2 of 3

Re: How do you use threads?

Posted: Sun Nov 07, 2010 10:28 am
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.

Re: How do you use threads?

Posted: Sun Nov 07, 2010 10:56 am
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.

Re: How do you use threads?

Posted: Sun Nov 07, 2010 11:07 am
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()

Re: How do you use threads?

Posted: Sun Nov 07, 2010 11:37 am
by Mud
debug.debug()
Ahh, very nice.

Re: How do you use threads?

Posted: Sun Nov 07, 2010 1:59 pm
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> "

Re: How do you use threads?

Posted: Sun Nov 07, 2010 5:20 pm
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...

Re: How do you use threads?

Posted: Thu Nov 11, 2010 3:06 pm
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:

Re: How do you use threads?

Posted: Thu Nov 11, 2010 3:29 pm
by thelinx
You find a thread library for Lua. I don't know any off-hand, so try googling around.

Re: How do you use threads?

Posted: Thu Nov 11, 2010 3:58 pm
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:

Re: How do you use threads?

Posted: Thu Nov 11, 2010 5:00 pm
by Robin
Lua Lanes?