public static bool CheckType(IntPtr ptr, int p, out string v) { if (LuaNativeMethods.lua_isuserdata(ptr, p) > 0) { object o = CheckObj(ptr, p); if (o is string) { v = o as string; return(true); } } else if (LuaNativeMethods.lua_isstring(ptr, p)) { v = LuaNativeMethods.lua_tostring(ptr, p); return(true); } v = null; return(false); }