The Lua engine is having exceptions when more than one script enter the engine at a time. Look into the MoonSharp documentation and see if either multiple instances need to be started up for async calls or if they need to be called in a different way. The exceptions can manifest with different exceptions. Examples:
Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
--> Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
--> Index was outside the bounds of the array.
--> Object reference not set to an instance of an object.
--> Unexpected type in table ctor : 0
--> Unexpected type in table ctor : 10
--> attempt to index a nil value
--> attempt to index a number value
To test this I created an alias that executed a Lua script and then repeated in fast succession with the #repeat command.
Lua Alias (named test):
local data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
local value = data[math.random(1, 10)]
local anotherVar = value * 5;
Cmd:Echo("Your value is " .. anotherVar)
Lua was altered to create a new script object each time one is run which fixes the concurrent bugs that were occurring when async scripts would fire at the same time.
The Lua engine is having exceptions when more than one script enter the engine at a time. Look into the MoonSharp documentation and see if either multiple instances need to be started up for async calls or if they need to be called in a different way. The exceptions can manifest with different exceptions. Examples: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
To test this I created an alias that executed a Lua script and then repeated in fast succession with the #repeat command.
Lua Alias (named test):
Hash Command:
#repeat 50 test