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

check if a table has a slot
cue
#1 Posted : Sunday, February 13, 2011 11:39:35 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/3/2011(UTC)
Posts: 60
Man

Thanks: 0 times
Was thanked: 4 time(s) in 4 post(s)
Can we have an API to check if a table has a specific slot (possibly also check the slot's type)? I'm using tables in some places for optional function arguments and need to inspect the table argument. I know I can just sq_get/sq_rawget and see if the function fails, but I'm only interested in the slot being pushed into the stack if it exists and has the right type.
fagiano
#2 Posted : Friday, February 18, 2011 2:53:45 PM(UTC)
Rank: Advanced Member

Groups: Registered, Administrators
Joined: 6/11/2005(UTC)
Posts: 1,055

Thanks: 0 times
Was thanked: 78 time(s) in 60 post(s)
Hi,
There wouldn't be any advantage in having a function that just check if the slot exists, as it would require an "full" table get anyway. sq_rawget() is as fast as it gets.

I hope this helps
Alberto
Follow me on Twitter @squirrellang
cue
#3 Posted : Wednesday, February 23, 2011 12:23:48 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/3/2011(UTC)
Posts: 60
Man

Thanks: 0 times
Was thanked: 4 time(s) in 4 post(s)
I wasn't concerned about speed, it was more of a convenience request. ;) But nevermind, I guess writing an auxiliary function that does what I want is better than adding it directly to Squirrel.
Guest
#4 Posted : Saturday, December 22, 2012 7:23:37 AM(UTC)
Rank: Guest

Groups:

Thanks: 0 times
Was thanked: 1 time(s) in 1 post(s)
Message was deleted by Moderator.
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.140 seconds.