Page 1 of 1

Textarea in detached inventory

PostPosted: Mon Feb 25, 2013 16:34
by 4aiman
I wanted to show detached inventory and this is what I get:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest: ../../include/irrString.h:330: T& irr::core::string<T, TAlloc>::operator[](irr::u32) [with T = wchar_t, TAlloc = irr::core::irrAllocator<wchar_t>, irr::u32 = unsigned int]: Assertion `!(index>=used)' failed.

Inventory DID show, but after 0.5-2 seconds minetest crashed. And that happens every time I try to do it.

I make this with help of a function:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
function showmessage(player, message)
    minetest.show_formspec(player, "message_box",
                "size[6,4]"..
                   "textarea[0.5,0.5;5,3;message;;"..message.."]")
end


Which I call like this ("name" here contains players name and <> nil and corresponds to one of the connected atm players):
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
showmessage(name,"Usage:\n /forgive <playername>")


Is it smth with the engine, or I'm doing it all wrong?

PostPosted: Mon Feb 25, 2013 19:34
by Traxie21
A stab in the dark, but try
print(tostring(message))
"textarea[0.5,0.5;5,3;message;"..tostring(message).."]"

PostPosted: Wed Mar 12, 2014 00:50
by Sokomine
In case it's still relevant: minetest.formspec_escape(string) ought to help.

PostPosted: Wed Mar 12, 2014 05:25
by 4aiman
Thanks, Sokomine!
To tell the truth I don't remember where did I try to use it...
But I always can search for the strings above in my game's folder :)
It's nice to get an answer now and not when I wouldn't be able to thank you (e.g. during last year I was banned).