SendLuaUIMsg Question

SendLuaUIMsg Question

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

SendLuaUIMsg Question

Post by very_bad_soldier »

When I send the following string (9 bytes) via SendLuaUIMsg I end up getting 10 bytes back in the recvFunction. Is it a bug or am I doing anything wrong?
I tried to figure out why AllyCursors-Widgets isnt working anymore (I think since 0.77b5) and noticed this (IMO strange) behavior.

Code: Select all

local msg = "123456789"
Spring.Echo( "Sending: " .. msg:len() )
SendLuaUIMsg( msg,"allies")
Output:

Code: Select all

Sending: 9

Code: Select all

function widget:RecvLuaMsg(msg, playerID)
	Spring.Echo( "Receiving: " .. msg:len() )
end
Output:

Code: Select all

 
Receiving: 10
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: SendLuaUIMsg Question

Post by lurker »

1. Check the changelog or mantis, then start getting really annoying in your calls for 0.78
2. What if you print each character? string.byte to help?
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: SendLuaUIMsg Question

Post by Peet »

Probably a null-character or a newline.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: SendLuaUIMsg Question

Post by jK »

yup, it is a bug and it the reason why AllyCursors isn't working and why the corfus in CA still shows the sphere.
Just wait for the next release of spring.
Post Reply

Return to “Lua Scripts”