Lua Script Environment Problem

Lua Script Environment Problem

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

Moderator: Moderators

Post Reply
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Lua Script Environment Problem

Post by PicassoCT »

Good evening dear ladies and gentil men,

i come to you in great distress. Namely beeing that i seem to have shot the ability of gadgets to retrieve a environment.
https://github.com/PicassoCT/Journeywar ... s.lua#L669
Many of the more complex units in my game rely on this ability and are thuse useless.

It also seems that all the Unitscript tables are missing from the environment.
These are tables such as COB, SFX etc.
My unit_script.lua is very close to the Zero-k one in setup. I shall compare it next to the spring default unitscript.lua.
https://github.com/PicassoCT/Journeywar ... script.lua

If you have any advice or direction - i would be gratefull.

Regards and have a nice evening
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Lua Script Environment Problem

Post by gajop »

Are you sure attackerID is not nil?
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Lua Script Environment Problem

Post by PicassoCT »

I do get a number, it is not the attackerID though.

I investigated further- seems that the arguments with which my UnitDamaged is called, do not include the projectile ID.

And solved it:

Here is what happened, i had old code in my gadgets.lua

which had commented out callins for
gadget:UnitDamaged
gadget:PreUnitDamaged

Code: Select all

--[[ Old
Here be old Code

--]]
The old code had been re-formatted by a formation tool, which added a space betwee the uncomment mark

Code: Select all

-- [[

Reactivating the dead code- let this be a warning to future generations. Delete old code.
Post Reply

Return to “Lua Scripts”