mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
1c6e583c87
This is the first attempt to finally implement the require() function on Lua. The main problem was how to solve conflicts between plugins that use the same library name. Here we separate each plugin like in a namespace, so require(name) inside a plugin will save the module in _LOADED["pluginName/libraryName"] to avoid conflicts with other libraryName from other plugins.
12 lines
319 B
Lua
12 lines
319 B
Lua
-- Copyright (c) 2023 Igara Studio S.A.
|
|
--
|
|
-- This file is released under the terms of the MIT license.
|
|
-- Read LICENSE.txt for more information.
|
|
|
|
local mod = require 'require_module'
|
|
assert(mod.a == 5)
|
|
mod.a = 6
|
|
|
|
local mod2 = require 'require_module'
|
|
assert(mod2.a == 6) -- Now mod and mod2 points to the same object
|