Code: Select all
local number=10
if (gadgetHandler:IsSyncedCode()) then
number=number+1
else
Spring.Echo(number)
end
Can someone explain this behaviour?
Moderator: Moderators
Code: Select all
local number=10
if (gadgetHandler:IsSyncedCode()) then
number=number+1
else
Spring.Echo(number)
end
Code: Select all
if (gadgetHandler:IsSyncedCode()) then
local number = 10
function gadget:SomeSyncedCallin(...)
number=number+1
_G.number=1
end
else
function gadget:SomeUnsyncedCallin(...)
Spring.Echo(SYNCED.number)
end
end
You mean http://springrts.com/wiki/Lua_sync_to_unsync ?Pithikos wrote:Such small understandable examples should be in the wiki! Easy to follow and comprehend in contrast to the "mines" example they have there.
I know what you mean. This is all new for me tooWell imagine that you are learning a new programming language/API and someone gives you an example of 3 pages long. Would be quite hard to locate the meat of what you are looking for. If you could break that thing to max 10 lines of code it would be gold worthy.
everybody can add/edit stuff!not allowing the public to add content
Yeah, like he said, you need to login to have the edit buttons be readily noticeable.knorke wrote:just log in with your forum account.
was expecting to see some mines from that gadget :p Anyway I took the initiative and updated the wiki(you will excuse me) with the example given from zwzsg.knorke wrote:I know what you mean. This is all new for me tooWell imagine that you are learning a new programming language/API and someone gives you an example of 3 pages long. Would be quite hard to locate the meat of what you are looking for. If you could break that thing to max 10 lines of code it would be gold worthy.
ie I do not know how "SendToUnsynced" works so I just put in the example of quantum as a link.
Would be nice if people with the knowledge would update the wiki, I can only spam my half-correct stuff in it because I hope that it will help at least a bit.
Maybe I will try to think of a shorter example but I this was the thing I was currently working on, so I just put it in. It is also a working examples that you can try out with ie XTA. (also with other mods but then needs changing of the unit names)
(will look like this: http://www.youtube.com/watch?v=eBiWbd3x33Q just without automatic unit moving, took that out to shorten the example)
everybody can add/edit stuff!not allowing the public to add content
just log in with your forum account.
Quite hard to notice it when it's at the bottom of the page. Maybe it would be more practical to have an [edit] option in every page so if someone tries to edit a page it redirects to a login page just like in wikipedeia.Yeah, like he said, you need to login to have the edit buttons be readily noticeable.
yea no problemAnyway I took the initiative and updated the wiki(you will excuse me) with the example given from zwzsg.