lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Thu, Mar 12, 2020 at 10:14 AM 云风 <cloudwu@gmail.com> wrote:


> 在 2020年3月12日,22:39,Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> 写道:
>
> 
>>
>> Is there any way to specify a seed when I create a new lua VM ? It's
>> very useful for reproduction of bugs .
>> If the seed is always random, the order of table iteration would be
>> different every time.
>

There is another reason that I want to set the seed by myself.

Our system use thousands lua VMs in one process. I make a small patch to share the function protos (including strings) among these VMs. So I need these VMs use the same seed, so that the strings’ hash can be  used in any of these VM.

If you're already patching the VM, it shouldn't be hard to just patch the seed assignment yourself.

/s/ Adam