Created
February 25, 2020 11:21
-
-
Save remyroez/baa67504e7fcdea405465b2f5a68b0b3 to your computer and use it in GitHub Desktop.
lua syntax sugar for basic values(number, function, coroutine)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://stackoverflow.com/questions/33988610/weird-behavior-of-syntax-sugarcolon-in-lua | |
local debug = require 'debug' | |
debug.setmetatable(0, { __index = math }) | |
debug.setmetatable(function() end, { __index = coroutine }) | |
debug.setmetatable(coroutine.create(function() end), { __index = coroutine }) | |
local table = require 'table' | |
table.new = function (self, t) | |
t = t or self | |
return setmetatable(t, { __index = table }) | |
end | |
setmetatable(table, { __call = table.new }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment