[solved] lua math.randomseed error

[solved] lua math.randomseed error

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

Moderator: Moderators

Post Reply
User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

[solved] lua math.randomseed error

Post by qray »

I have a problem with a lua script: http://pastebin.com/P3pKCSkL
(used for example in the map core platform - to test: spawn via cheat a unit in the voidground/water area).

I use there in line 222 math.randomseed which works totally fine on my main computer. Today, I tested on another system (main difference: spring 96 instead of 98, in case it matters).
There, I get this error message:

Code: Select all

[f=0000451] Error: LuaRules::RunCallIn: error = 2, GameFrame, [string "LuaRules/Gadgets/void.lua"]:222: attempt to call field 'randomseed' (a nil value)
stack traceback:
	[string "LuaRules/Gadgets/void.lua"]:222: in function 'findVoidUnits'
	[string "LuaRules/Gadgets/void.lua"]:155: in function 'GameFrame'
	[string "LuaRules/gadgets.lua"]:838: in function <[string "LuaRules/gadgets.lua"]:836>
	(tail call): ?
Any idea why it works on one system and not on the other? In my ignorance I thought lua math functions would be available everywhere.
Last edited by qray on 04 Apr 2015, 15:07, edited 1 time in total.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: lua math.randomseed error

Post by FLOZi »

spring 96 instead of 98, in case it matters
Yes

Added in 97

https://github.com/spring/spring/blob/d ... g.txt#L235
User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

Re: lua math.randomseed error

Post by qray »

Ah! Thanks!

So I do not have to go bug hunting (just work on my ignorance) :wink:
Post Reply

Return to “Lua Scripts”