Log In  
Follow
DrDiagoras
[ :: Read More :: ]

PICO-8 print behavior is inconsistent with Lua standard:

mmt={}
mt=setmetatable({},mmt)
t=setmetatable({},mt)

function mmt:__index(k)
 print('mt.'..k)
end

print(t)

This code should not output mt._tostring as, per language manual, I quote: "the access to a metamethod does not invoke other metamethods". You can check it on the official Lua demo too.

P#134816 2023-09-24 00:49 ( Edited 2023-09-24 16:32)

[ :: Read More :: ]

I'm not sure if this is a bug or a deliberate limitation, but it seems that coresume call silently drops everything but the first argument, passed to the yield or return in the coroutine. When you

cor=cocreate(function()
 yield(1,2,3)
 return 4,5,6
end)

s1,a,b,c=coresume(cor)
s2,x,y,z=coresume(cor)

, all of b,c,y,z will be nil. In standard lua passing multiple values out of coroutine is widely used quirk, so it would be nice to have it on PICO-8 too.

P#132005 2023-07-15 15:30