Send / Recv Unsynced lua troubles

Send / Recv Unsynced lua troubles

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

Moderator: Moderators

Post Reply
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Send / Recv Unsynced lua troubles

Post by FLOZi »

Code: Select all

[      0] LuaRules::RunCallIn: error = 2, RecvFromSynced, [string "LuaGadgets/actions.lua"]:247: attempt to call local 'func' (a nil value)
Only caused when there is a CRAIG AI bot running in S44.

Only bit of CRAIG code dealing with SendToUnsynced is this:

Code: Select all

local function Initialize(self)
	Log("SYNCED: Initialize")
	-- Set up the forwarding calls to the unsynced part of the gadget.
	local SendToUnsynced = SendToUnsynced
	for _,callIn in pairs(callInList) do
		local fun = gadget[callIn]
		if (fun ~= nil) then
			gadget[callIn] = function(self, ...) fun(self, ...) SendToUnsynced(callIn, ...) end
		else
			gadget[callIn] = function(self, ...) SendToUnsynced(callIn, ...) end
		end
		gadgetHandler:UpdateCallIn(callIn)
	end
end
When both CRAIG and kloots new healthbar gadget are running together, I instead get this error:

Code: Select all

[      0] error = 2, LuaRules/draw.lua, error = 2, luagadgets/gadgets.lua, [string "LuaGadgets/actions.lua"]:54: attempt to index local 'g' (a function value)
And LuaRules ceases to function altogether.

Any and all help appreciated. :? :shock:
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Send / Recv Unsynced lua troubles

Post by FLOZi »

Reverting my changes to CRAIG ( http://spring1944.svn.sourceforge.net/v ... threv=3014 ) removes the error pertaining to CRAIG, but there is still the conflict with the healthbar gadget when both run together. I'm in way past my depth. :(


edit: Nevermind, found the RecvFromSynced alternative in the healthbar gadget once jK told me action handler was bugged outside of CA and figured out the rest from there. :-)
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: Send / Recv Unsynced lua troubles

Post by TheFatController »

FLOZi wrote:jK told me action handler was bugged outside of CA
:x
Post Reply

Return to “Lua Scripts”