Skip to content

Instantly share code, notes, and snippets.

@bjurd
bjurd / more__tostring.lua
Last active July 6, 2025 14:36
Show more information in __tostring
local ENTITY = FindMetaTable("Entity")
local CSENTITY = FindMetaTable("CSEnt")
local PLAYER = FindMetaTable("Player")
local WEAPON = FindMetaTable("Weapon")
function ENTITY:__tostring()
if not IsValid(self) then
return "Entity [Invalid]"
end
@bjurd
bjurd / text.h
Created April 25, 2025 22:52
"Universal" text class
#pragma once
#include <string>
#include <xstring>
#include <codecvt>
#include <locale>
#define FOREIGN_OPERATOR(TA, TB) \
TA& operator += (TB B) \
{ \
@bjurd
bjurd / errorvar.lua
Last active May 19, 2025 21:20
Show Variables in Lua Errors
ErrorVar = ErrorVar or {}
require("debug") -- https://github.com/bjurd/gm_debug
local _R = debug.getregistry()
ErrorVar.OriginalErrorHandler = ErrorVar.OriginalErrorHandler or _R[1]
function ErrorVar.ErrorHandler(...)
local Level = 1