print() output for luacontroller

Post Reply
mstram
New member
Posts: 5
Joined: Tue Oct 31, 2017 03:11
GitHub: mstram
IRC: mstram
In-game: mstram

print() output for luacontroller

by mstram » Post

I have posted this issue on the mesecons github page..

https://github.com/minetest-mods/meseco ... -340624255

I've just downloaded minetest-0.4.16-win64 and the current mesecons.

Is the print() function supposed to be working ?

If so, where does it output to ? (The chat / screen output would be a nice place (like the lua mod) !

I've enabled "Show debug info" in the Minetest client settings, but that didn't help.

Is there some other setting I need to change ?

I took a look at the init.lua script and see that print is actually doing a "safe_print" : print(dump(param)), but where is "dump" supposed to be outputting to ?

The http://dev.minetest.net/dump page is not much help there

ssieb commented :
"The dump function converts the given value to a printable string. The print function outputs a string to the server debug log."

To which I replied :

So print() *should* be working ?
Here is a script I'm trying to run : It works, as far as activating the ports, but no output is showing up in bin\debug.txt

Code: Select all

if (event.type == "on" and event.pin.name == "A") then 
 port.c = not port.c 
 print("zop port.c") 
 port.d = not port.c 
end 
I used "zop" for something easy to grep in debug.txt

mstram
New member
Posts: 5
Joined: Tue Oct 31, 2017 03:11
GitHub: mstram
IRC: mstram
In-game: mstram

Re: print() output for luacontroller

by mstram » Post

Btw this is on Win 7 Pro SP1

Is anybody else running Win, and have print() working ?

cubestacker
New member
Posts: 4
Joined: Wed Nov 01, 2017 00:03

Re: print() output for luacontroller

by cubestacker » Post

I'm using "MobaXterm" ( https://mobaxterm.mobatek.net/download.html , take the free version) and start with /drives/c/Users/<username>/minetest/minetest-0.4.16-win32-msvc/bin/minetest.exe to get debug output on Windows.
I have extracted the minetest program in a directory named 'minetest', you will have to adapt that path and replace "<username>" with your name on the computer.

mstram
New member
Posts: 5
Joined: Tue Oct 31, 2017 03:11
GitHub: mstram
IRC: mstram
In-game: mstram

Re: print() output for luacontroller

by mstram » Post

Thanks I'll take a look at that.

But that seems to confirm my suspicion that either the print() function has been programmed for 'nix systems, or there is something "not connecting" in luacontroller.

In the meantime, I found that if I replace the safe_print code in mesecons_luacontroller\init.lua from

Code: Select all

print(dump(param))
to

Code: Select all

minetest.chat_send_all(dump(param))
then print("foo") will output to the chat window (which is preferable to either the "console" or debug.txt (for my single player use)

magnotesis
New member
Posts: 1
Joined: Sun May 27, 2018 09:43

Re: print() output for luacontroller

by magnotesis » Post

Thanks mstram. I've changed the code in init.lua and it's working :). Legend!

User avatar
csirolli
Member
Posts: 133
Joined: Mon Jan 15, 2018 21:46
GitHub: HeyITGuyFixIt
IRC: CSirolli
In-game: CSirolli
Location: Florida, USA
Contact:

Re: print() output for luacontroller

by csirolli » Post

FYI, if you start MineTest from the command line, it should print to the command line when it runs a print() function.

ApothecaryOfLight
New member
Posts: 3
Joined: Fri Feb 21, 2020 18:44
GitHub: ApothecaryOfLight
IRC: ApothecaryOfLight
In-game: ApothecaryOfLight

Re: print() output for luacontroller

by ApothecaryOfLight » Post

csirolli is wrong. This is not the behavior exhibited in Windows 10 when launching Minetest from the Command Prompt.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests