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.
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: How to run both love2d and lua

Post by togFox »

print(text)
or
print('e')

And use lovec.exe so you can see the console.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Turn-based PBEM horse stable (racing) management sim: https://togfox.itch.io/horse-stable-manager
https://discord.gg/HeHgwE5nsZ
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 »

itsatomf wrote: Thu Aug 25, 2022 1:42 am
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.
You can. You can use print() anywhere, even in love.draw(), love.update(), etc. What exactly you mean by @i can't use built-in lua functions with love"? You can't see output of "print()"? If that's the problem, then it's not "how to use built-in lua functions in love". Make sure that your ide or whatever you use was configured to output something.
Or, maybe, just maybe, you talking about output buffering, which will not send anything to terminal until game is closed?
try call io.stdout:setvbuf("no") (http://www.lua.org/manual/5.2/manual.ht ... %3asetvbuf) at start of your main.lua. After that love will send anything with "print()" immediately in terminal.
itsatomf
Prole
Posts: 5
Joined: Wed Aug 24, 2022 7:37 am

Re: How to run both love2d and lua

Post by itsatomf »

BrotSagtMist wrote: Thu Aug 25, 2022 2:11 am You where trying it without quotation marks the whole time i must assume.
print('e') will absolutely work. print(e) will not...
oops um that's a typo but I swear I tried it with the quotation mark and it didn't work either :cry:
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 »

Maybe you have problem with output buffering? Try adding

Code: Select all

io.stdout:setvbuf("no")
to the top of main.lua
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests