print() output for luacontroller

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 » Tue Oct 31, 2017 11:47

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 » Wed Nov 01, 2017 11:18

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
In-game: Och_Noe

Re: print() output for luacontroller

by cubestacker » Wed Nov 01, 2017 18:57

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 » Wed Nov 01, 2017 20:08

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 » Sun May 27, 2018 09:45

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

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

Re: print() output for luacontroller

by csirolli » Mon May 28, 2018 04:29

FYI, if you start MineTest from the command line, it should print to the command line when it runs a print() function.
Jesus is the only Way to heaven, the only saving Truth, and the only Life that is worth living.
 


Return to Problems



Who is online

Users browsing this forum: mtf, Steamed_Punk and 2 guests