2021-09-18 01:01 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0006422Spring engineLuapublic2020-09-23 19:48
Assigned To 
Product Version104.0 +git 
Target VersionFixed in Version 
Summary0006422: math.random(x,y) in unitdefs
Descriptioncalling math.randon(1,10) in LuaParser enviroment (Unit def file) returns random values between 0 and 1 like there were no arguments at all.
Steps To ReproduceSpring.Echo(math.random(1,someothernumber)) in any unitdef file, prefferably multiple times
Additional Informationnone
Tagslua math
Checked infolog.txt for ErrorsYes
Attached Files




sprung (reporter)

The "real" random is https://github.com/spring/spring/blob/develop/rts/Lua/LuaHandleSynced.cpp#L1367 but defs parsing uses https://github.com/spring/spring/blob/develop/rts/Lua/LuaParser.cpp#L521


Damgam (reporter)

I've figured that out by myself.

-Issue History
Date Modified Username Field Change
2020-09-23 17:51 Damgam New Issue
2020-09-23 17:52 Damgam File Added: Bez tytułu.jpg
2020-09-23 17:52 Damgam Tag Attached: lua math
2020-09-23 19:11 sprung Note Added: 0020536
2020-09-23 19:48 Damgam Note Added: 0020537
+Issue History