How to run both love2d and lua

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
itsatomf
Prole
Posts: 5
Joined: Wed Aug 24, 2022 7:37 am

How to run both love2d and lua

Post by itsatomf »

The title is confusing ikr :ehem:

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?
Andlac028
Party member
Posts: 174
Joined: Fri Dec 14, 2018 2:27 pm
Location: Slovakia

Re: How to run both love2d and lua

Post 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()
Last edited by Andlac028 on Thu Aug 25, 2022 4:39 am, edited 1 time in total.
User avatar
GVovkiv
Party member
Posts: 685
Joined: Fri Jan 15, 2021 7:29 am

Re: How to run both love2d and lua

Post 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.
User avatar
BrotSagtMist
Party member
Posts: 657
Joined: Fri Aug 06, 2021 10:30 pm

Re: How to run both love2d and lua

Post 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
obey
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

Re: How to run both love2d and lua

Post by pgimeno »

Or maybe he needs to use lovec.exe instead of love.exe to see the output of print().
User avatar
GVovkiv
Party member
Posts: 685
Joined: Fri Jan 15, 2021 7:29 am

Re: How to run both love2d and lua

Post by GVovkiv »

or use some sort of ide with built-in terminal, who knows.
itsatomf
Prole
Posts: 5
Joined: Wed Aug 24, 2022 7:37 am

Re: How to run both love2d and lua

Post 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 :(
itsatomf
Prole
Posts: 5
Joined: Wed Aug 24, 2022 7:37 am

Re: How to run both love2d and lua

Post 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?
itsatomf
Prole
Posts: 5
Joined: Wed Aug 24, 2022 7:37 am

Re: How to run both love2d and lua

Post 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.
User avatar
BrotSagtMist
Party member
Posts: 657
Joined: Fri Aug 06, 2021 10:30 pm

Re: How to run both love2d and lua

Post by BrotSagtMist »

You where trying it without quotation marks the whole time i must assume.
print('e') will absolutely work. print(e) will not...
obey
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests