[OK]を、私は番号をランダム化関係のLuaでプログラムを書いていますし、それが正常に動作します... math.randomseed(os.time())
スタックオーバーフローときmath.randomseedを呼び出す(os.time())
私はそれを追加することなく、
lua: Main.lua:17: stack overflow
stack traceback:
Main.lua:17: in function 'balancestregnths'
...
local group1stregnths = 0
local group2stregnths = 0
function balancestregnths()
math.randomseed(os.time())
local assignedstrengths = math.random(1,6)
if assignedstrengths == 1 then
if group1stregnths == 2 then
balancestregnths()
end
if group1stregnths < 2 then
group1stregnths = group1stregnths + 1
end
end
return assignedstrengths
end
そして、ここではオーバーフローです:それはmath.randomseed(os.time())
私のコードはここに示されているのラインでスタックオーバーフローが発生します
助けが必要ですか?
私はコードとエラーを追加しました! – MrOverflow
関数の前に 'randomseed'を宣言しました。答えとして回答を投稿できるのであれば、私は喜んでそれを受け入れます!ありがとう! – MrOverflow
私はあなたのコードを再フォーマットする自由を取った。適切なインデントと空白行のより賢明な使い方で読みやすい*ロット*です。 –