YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Double call dofile
Alexandr
#1 Posted : Monday, August 16, 2021 3:25:01 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/16/2021(UTC)
Posts: 1
Location: Russian

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Hi everyone!

If I call 'dofile' for the same 'nut' twice 'newslot' isn't called for the second time and all the exported methods (from the first call of 'newslot') are lost.
Is it OK? Is there any way to detect the second call of 'newslot'?
absence
#2 Posted : Wednesday, August 25, 2021 7:17:01 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 8/23/2014(UTC)
Posts: 142
Man
Location: Northern Germany & Lincolnshire, U.K.

Thanks: 2 times
Was thanked: 10 time(s) in 10 post(s)
This is intended behaviour.
Metamethods are not bound to squirrel language instructions, but rather internal processing _caused_ by instructions.
Hence newslot is called when a new slot in fact gets created, while metmethod set is called for an already existing slot and gets assigned a new value or reference (which is exactly what happens when you "dofile" a second time in the same table context).
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.033 seconds.