Search found 68 matches

by unixfreak
Wed Aug 15, 2018 3:49 pm
Forum: Support and Development
Topic: [SOLVED] How can i rewind a sound source, now that love.audio.rewind(source) has been removed?
Replies: 2
Views: 208

Re: [SOLVED] How can i rewind a sound source, now that love.audio.rewind(source) has been removed?

Found a solution... turns out it was quite simple. Now it seems :stop() on an audio source automatically rewinds. Solved.

Code: Select all

function sound:play(fx)
	fx:stop()
	fx:play()
end
by unixfreak
Wed Aug 15, 2018 3:29 pm
Forum: Support and Development
Topic: [SOLVED] How can i rewind a sound source, now that love.audio.rewind(source) has been removed?
Replies: 2
Views: 208

[SOLVED] How can i rewind a sound source, now that love.audio.rewind(source) has been removed?

Hi, tried searching, and fiddling about but cannot find a way to do this. As per; https://love2d.org/wiki/love.audio.rewind (which is now removed since 11.0) An example why i'd like to find a way to do this; a player can collect a series of pickups (coins, gems or whatever), which all use the same s...
by unixfreak
Tue Aug 14, 2018 10:04 pm
Forum: Support and Development
Topic: [SOLVED] Handling error exceptions for assert(loadstring(str))() ?
Replies: 8
Views: 329

Re: [SOLVED] Handling error exceptions for assert(loadstring(str))() ?

Yeah, you missed returning the value for pcall: pcall(function() return assert(... Edit: also, you missed the second argument, now that I look closer. The first argument is always a boolean. That was probably the problem. Yeah, looking at that now, i see that is the case. Can't thank you enough for...
by unixfreak
Tue Aug 14, 2018 9:55 pm
Forum: Support and Development
Topic: [SOLVED] Handling error exceptions for assert(loadstring(str))() ?
Replies: 8
Views: 329

Re: Handling error exceptions for assert(loadstring(str))() ?

By the way, i posted to soon about this being solved, whilst it didn't crash on invalid syntax, it did crash when the syntax was valid (something about expecting string/boolean error). You probably don't want to use assert , as that would need more layers of error handling. Try this: local fn, err =...
by unixfreak
Tue Aug 14, 2018 9:46 pm
Forum: Support and Development
Topic: [SOLVED] Handling error exceptions for assert(loadstring(str))() ?
Replies: 8
Views: 329

Re: Handling error exceptions for assert(loadstring(str))() ?

Oh nevermind, i just got this working; local out = pcall(function() assert(loadstring(console.command))() end) if out then console:print(out) else console:print("ERROR: invalid lua snytax!") end This works! Thanks for reminding me of pcall, i gave up the other day trying to solve this, but misunders...
by unixfreak
Tue Aug 14, 2018 9:33 pm
Forum: Support and Development
Topic: [SOLVED] Handling error exceptions for assert(loadstring(str))() ?
Replies: 8
Views: 329

Re: Handling error exceptions for assert(loadstring(str))() ?

Looks like a job for pcall . Hi, thanks for replying. I previously looked up that function, but can't understand how i would use it here. How would i go about using pcall for this snippet? local out = assert(loadstring(console.command))() console:print(out) I have tried something such as: local out...
by unixfreak
Tue Aug 14, 2018 8:54 pm
Forum: Support and Development
Topic: [SOLVED] Handling error exceptions for assert(loadstring(str))() ?
Replies: 8
Views: 329

[SOLVED] Handling error exceptions for assert(loadstring(str))() ?

I am trying to add scriptable lua to a console as part of a game, for example to change variables quickly or run custom lua code to edit levels etc. I have figured out i can use something like this: local out = assert(loadstring(console.command))() Where the console uses text input to supply the con...
by unixfreak
Mon Aug 06, 2018 12:23 am
Forum: Support and Development
Topic: [Solved] Exit love.keypressed() function
Replies: 1
Views: 134

Re: Exit love.keypressed() function? Cannot figure this out

Derp. Ignore this post... i had some keypress input that was placed in some update() functions... hence they were triggering keypresses outside of the love.keypressed() function... I ended up wrapping the keyboard related code in a block like: if not console.active then -- blah blah end Solved!
by unixfreak
Mon Aug 06, 2018 12:18 am
Forum: Support and Development
Topic: [Solved] Exit love.keypressed() function
Replies: 1
Views: 134

[Solved] Exit love.keypressed() function

Can anyone explain why this doesn't work? function love.keypressed(key) if console.active then console:keypressed(key) return -- <---should exit function here end player:keypressed(key) --[[ other code etc.... than should only be run when console.active = false --]] end The problem is that the line ...
by unixfreak
Fri Jul 20, 2018 8:44 pm
Forum: Games and Creations
Topic: Phibonacci: a 2048-like game with the Fibonacci numbers
Replies: 2
Views: 1020

Re: Phibonacci: a 2048-like game with the Fibonacci numbers

Hey this is an interesting take on the 2048 game. Nicely done!