SetShareLevel() does not work

SetShareLevel() does not work

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

Moderator: Moderators

Post Reply
Lupus
Posts: 37
Joined: 18 Jan 2008, 22:23

SetShareLevel() does not work

Post by Lupus »

Hello there.
I'm trying to write a simple widget, to set sharing resources level at the beginning of each game.
I've found the function described in API.txt:
SetShareLevel(string "metal" | "energy", number fraction) -> nil

I wrote a widget:

Code: Select all

function widget:GetInfo() 
  return { name = "MyWidget" }
end

function widget:Initialize()
  Spring.SetShareLevel("metal", 0.9)
  Spring.SetShareLevel("energy", 0.8)
end
The energy is set to 0.8, but the metal isn't!
Only the second call of the function SetShareLevel() is evaluated, the first one isn't...
Why is that?
Post Reply

Return to “Lua Scripts”