In the source code, you'd use R_TextureNumForName, but that hasn't (yet) been implemented into Lua and I'm not sure if there's any way to do it outside of EXE mods. A trick you could use is making a map with a wall that uses the texture you want. Then use a Lua script to print that wall's toptexture/bottomtexture/midtexture and manually build a table converting all of the string texture names to their number equivalents.