Skip to content

Lua: don't create globals #67

Description

@hryx

When calling require('libmodipulatelua') it creates a global table called "modipulate" containing the needed functions. This practice is frowned upon by some -- the nicer way to do this is have it return the package. Then you can use it like this:

local modipulate = require('libmodipulatelua')
modipulate.init()
modipulate.loadSong('poop.xm')

Disclosure: I haven't made any C modules for Lua, so I don't know if there any gotchas in making it behave this way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions