Page 1 of 2
How to run both love2d and lua
Posted: Wed Aug 24, 2022 7:47 am
by itsatomf
The title is confusing ikr
So, how do I run both love2d functions and lua builtin functions, like when I'd like to debug, smth like:
Code: Select all
text = "e"
print(e)
function love.draw()
love.graphics.print(text)
end
By doing so, I could run both love2d functions and the functions from lua itself.
So, how could I?
Re: How to run both love2d and lua
Posted: Wed Aug 24, 2022 10:34 am
by Andlac028
I don't know, if I understand correctly, but in love2d, you can use both build-in lua and love2d functions. For example:
Code: Select all
text = "e"
function love.draw()
print(text)
love.graphics.print(text)
end
EDIT: fixed bad variable name in print()
Re: How to run both love2d and lua
Posted: Wed Aug 24, 2022 10:59 am
by GVovkiv
love is just lua (luajit to be specific) interprier with bundled ontop sdl2, audio coding/decoding, and more functionality, so i'm not sure what you mean.
Re: How to run both love2d and lua
Posted: Wed Aug 24, 2022 11:03 am
by BrotSagtMist
Maybe he wants print() to return on the game screen AND the terminal?
Code: Select all
op=love.graphics.print
love.graphics.print=function(...)
print(...)
op(...)
end
Re: How to run both love2d and lua
Posted: Wed Aug 24, 2022 11:09 am
by pgimeno
Or maybe he needs to use lovec.exe instead of love.exe to see the output of print().
Re: How to run both love2d and lua
Posted: Wed Aug 24, 2022 12:48 pm
by GVovkiv
or use some sort of ide with built-in terminal, who knows.
Re: How to run both love2d and lua
Posted: Thu Aug 25, 2022 1:37 am
by itsatomf
Andlac028 wrote: ↑Wed Aug 24, 2022 10:34 am
I don't know, if I understand correctly, but in love2d, you can use both build-in lua and love2d functions. For example:
Code: Select all
text = "e"
function love.draw()
print(e)
love.graphics.print(text)
end
that didn't worked for me
Re: How to run both love2d and lua
Posted: Thu Aug 25, 2022 1:40 am
by itsatomf
pgimeno wrote: ↑Wed Aug 24, 2022 11:09 am
Or maybe he needs to use lovec.exe instead of love.exe to see the output of print().
huh?
Re: How to run both love2d and lua
Posted: Thu Aug 25, 2022 1:42 am
by itsatomf
GVovkiv wrote: ↑Wed Aug 24, 2022 10:59 am
love is just lua (luajit to be specific) interprier with bundled ontop sdl2, audio coding/decoding, and more functionality, so i'm not sure what you mean.
I mean like, I can't run both lua and love2d function, like I can love.graphics.print("e") to the screen, but I can't print("e") (<- is a builtin function btw not love.graphics.print(), just print()) to the terminal.
Re: How to run both love2d and lua
Posted: Thu Aug 25, 2022 2:11 am
by BrotSagtMist
You where trying it without quotation marks the whole time i must assume.
print('e') will absolutely work. print(e) will not...