Gamesparks plugin will not load when using lua strict

This will prevent the gamespark plugin from loading:

local mt = getmetatable(\_G) if mt == nil then   mt = {}   setmetatable(\_G, mt) end \_\_STRICT = true mt.\_\_declared = {} mt.\_\_newindex = function (t, n, v)   if \_\_STRICT and not mt.\_\_declared[n] then     local w = debug.getinfo(2, "S").what     if w ~= "main" and w ~= "C" then       error("assign to undeclared variable '"..n.."'", 2)     end     mt.\_\_declared[n] = true   end   rawset(t, n, v) end

local GS = require(“plugin.gamesparks”)

I think this is a bug?

You should reach out to GameSparks. They maintain their own plugin.  

Rob

This might be a problem with the plugin, but debugging has revealed a problem with the way the Library generator works (internally opaque).

See the attachment. There is no gamesparks specific content, just Corona and pure lua, with some paths that are gamesparks.

Attempting to load the plugin with “strict.lua” trying to catch global leaks, any require into the plugin folder results in a failed plugin load.

This is a Corona specific issue. If this is intentional, it seems wrong and will prevent a classic type of static check (prevent global scope pollution).

Can you submit your .zip file to us as a bug report? It needs a config.lua added, but you can use the “Report a Bug” link at the top of this page and write up a good description of the issue and attach the zip file.

Thanks

Rob

@jack,

I’m not clear why you’re doing this.  Are you simply trying to verify that your code is not creating unnecessary global as as a pre-release validation step or is this something you intend to have enabled in your release.

If the latter, I think you might be safer living with some unwanted global creation versus a crash. 

Just some input. 

@roaminggamer

The strict.lua is my first go-to tool when checking someone’s lua code.

In this case, it came up when trying to look into the gamespark library, which was failing in my project (where this is also enabled) and then the test harness for their Corona library project and eventually the Corona library template project.

The crash is preventing me from understanding what a third party plugin is doing because Corona’s plugin loading system has an internal leak. This is not a production stopping issue, but it’s not trivial for my very large project.

You should reach out to GameSparks. They maintain their own plugin.  

Rob

This might be a problem with the plugin, but debugging has revealed a problem with the way the Library generator works (internally opaque).

See the attachment. There is no gamesparks specific content, just Corona and pure lua, with some paths that are gamesparks.

Attempting to load the plugin with “strict.lua” trying to catch global leaks, any require into the plugin folder results in a failed plugin load.

This is a Corona specific issue. If this is intentional, it seems wrong and will prevent a classic type of static check (prevent global scope pollution).

Can you submit your .zip file to us as a bug report? It needs a config.lua added, but you can use the “Report a Bug” link at the top of this page and write up a good description of the issue and attach the zip file.

Thanks

Rob

@jack,

I’m not clear why you’re doing this.  Are you simply trying to verify that your code is not creating unnecessary global as as a pre-release validation step or is this something you intend to have enabled in your release.

If the latter, I think you might be safer living with some unwanted global creation versus a crash. 

Just some input. 

@roaminggamer

The strict.lua is my first go-to tool when checking someone’s lua code.

In this case, it came up when trying to look into the gamespark library, which was failing in my project (where this is also enabled) and then the test harness for their Corona library project and eventually the Corona library template project.

The crash is preventing me from understanding what a third party plugin is doing because Corona’s plugin loading system has an internal leak. This is not a production stopping issue, but it’s not trivial for my very large project.