moonsharp icon indicating copy to clipboard operation
moonsharp copied to clipboard

"debug" module is not available on the Unity

Open serge-shaldanov opened this issue 6 years ago • 1 comments

Hello for everyone!

I'm trying to use debug.setmetatable from my Lua script (Unity environment).

C#:

string luaScript = ...;
Script.RunString(luaScript);

Lua script:

print(debug.setmetatable)

Unfortunately, I get the following error when running this script:

attempt to index a nil value

Next, I'm trying to check the availability of debug module:

Script.RunString("return debug")

This script returns the Nil value for me.

I'm check out this doc Standard Library Progress, and it says that debug and debug.setmetatable are supported constructions.

Please tell me what I'm doing wrong?

(Moonsharp 2.0.0.0 Unity 2018.2.14f1)

serge-shaldanov avatar Jan 08 '19 14:01 serge-shaldanov

The debug module is disabled by default. This is documented here.

Benjamin-Dobell avatar Feb 13 '19 09:02 Benjamin-Dobell