• A hide for Draw?
    5 replies, posted
I was wondering, considering I've seen things that look like they've been done using Draw, is there a way to hide things done using draw? If so, how?
[lua] draw = setmetatable({},{__index = function() return (function() return 0 end) end}) [/lua] :v:
[QUOTE=ralle105;25659878][lua] draw = setmetatable({},{__index = function() return (function() return 0 end) end}) [/lua] :v:[/QUOTE] Could you explain to me how that works? Sorry, I'm still rather new to Lua. Nevermind, apparently Draw will take a boolean whether or not to draw itself. Silly me.
[QUOTE=thejjokerr;25662118]Can you still explain it please?[/QUOTE] Whenever you try to access a non existing member of the draw table (which is equal to the first argument of setmetatable) the __index function of the metatable (which is the second argument to setmetatable) will be called, which in turns returns an empty function (which returns 0 to prevent scripts using draw.GetFontSize from erroring) All in all it's a shortcut to setting all draw.* functions to do nothing.
-snip- Didn't noticed the above post.
Sorry, you need to Log In to post a reply to this thread.