[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.3 Suggestion: extend lua_(get|set)uservalue() to associate userdata-to-userdata
- From: Sean Conner <sean@...>
- Date: Mon, 2 Dec 2013 01:01:11 -0500
It was thus said that the Great Sir Pogsalot once stated:
> I am saying that it is out of my control, as it is done by code I did not
> write. So the metatable check works but the subsequent rawlen() fails.
That's what I'm not understanding---the call to lua_rawlen(). To me, it
sounds like a defensive programmer going overboard. Personally, I don't
believe in defensive programming as it hides bugs [1]. Trust the
programmer; do NOT trust the outside world though.
> luaL_checkudata() does not prevent a user from causing a segfault if they
> match up your mt with a very small userdata...
It's not the user that causes that, it's the programmer.
-spc (Fail fast)
[1] Writing Solid Code_ by Steve Maguire goes into this in depth. It
was one of only two books I've read over the past 25 years that
fundamentally changed how I write code.