Skip to content

Commit

Permalink
Fix function environment scoping issue
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmcwatters authored Nov 23, 2016
1 parent 5067ce2 commit 7954189
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,15 @@ function package.inherit( base )
end
end

-------------------------------------------------------------------------------
-- setmodule()
-- Purpose: Creates a module
-- Input: name - Name of mdoule
-------------------------------------------------------------------------------
local function setmodule( name )
module( name, package.class )
end

-------------------------------------------------------------------------------
-- class()
-- Purpose: Creates a class
-- Input: name - Name of class
-------------------------------------------------------------------------------
function class( name )
setmodule( name )
local function setmodule( name )
module( name, package.class )
end setmodule( name )
-- Make the class available to the environment from which it was defined
local _M = package.loaded[ name ]
setfenv( 2, _M )
Expand Down

0 comments on commit 7954189

Please sign in to comment.