It looks like you're new here. If you want to get involved, click one of these buttons!
I want to make a metamethod in order to, for example, the type(Vector2(0,0))
was "Vector2D", not "table". To do this, I rewrote the type function from Lua
local _type = type
function type(v)
local T = _type(v)
if T == "table" then
local tf = getmetatable(v).__type
if _type(tf) == "function" then
return tf(v)
else
return tostring(tf or T)
end
else
return T
end
end
But when I run the project, Codea crashes every time (the Problem disappears if i rewrite the type function inside the setup function). Why? How to fix this?
Comments
Okay, I see what the problem is. I haven't checked whether the table has metatable. Now everything works as it should