Cannot print() from lua code to windows 10 powershell

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.
Post Reply
leankyr
Prole
Posts: 6
Joined: Sun Nov 08, 2020 6:09 pm

Cannot print() from lua code to windows 10 powershell

Post by leankyr »

download.1.png
download.1.png (267.4 KiB) Viewed 4957 times
Hello fellows,

I found this so post about printing to powershell?? LUA console? however I cannot grasp what it is saying.
https://stackoverflow.com/questions/421 ... tom-editor.
Should I download this console?? should I try to sth else? Should the Lua console come built in with love2d?
On ubuntu there was no such problem, everything worked out of the box.

Cheers
leankyr
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Cannot print() from lua code to windows 10 powershell

Post by ReFreezed »

What exactly are you trying to do? PowerShell is just a command line tool - you don't print "to" it. If you just want to see the output of your program in a console window, run lovec.exe instead of love.exe (the former being the console version of LÖVE - in Windows there's a distinction between console programs vs windowed programs, unlike Linux).

And, as the SO post's answer mentions, Lua buffers output by default, so you probably want to put io.stdout:setvbuf("no") to the top of main.lua so you can see any output immediately.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
leankyr
Prole
Posts: 6
Joined: Sun Nov 08, 2020 6:09 pm

Re: Cannot print() from lua code to windows 10 powershell

Post by leankyr »

Thank you sir!! Running lovec instead of love from the powershell worked. I just had not noticed the lovec application in the ProgramFIles/love/.

Small irrelevant note: As I can see you cannot add files to an answer right?
User avatar
nikneym
Citizen
Posts: 56
Joined: Sat Mar 09, 2013 1:22 pm
Contact:

Re: Cannot print() from lua code to windows 10 powershell

Post by nikneym »

You have to change your build system in order to do that. Go to Tools > Build System > New Build System... in Sublime Text and paste:

Code: Select all

{
    "selector": "source.lua",
    "file_regex": "^Error: (?:[^:]+: )?([^: ]+?):(\\d+):() ([^:]*)$",
    "windows": {
        "cmd": ["lovec", "${folder:${file_path}}"],
        "shell": true
    },
}
then save and name it way you like. (maybe LOVE2D-Console) Next time when building your project, choose build system as LOVE2D-Console from Tools > Build System.

Also you can do the same thing by creating a conf.lua file and add t.console = true property. Check out config files.
Post Reply

Who is online

Users browsing this forum: No registered users and 223 guests