From 5051d85288da534947f83055a8a1e318e0493d8e Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Sun, 23 Feb 2014 15:01:34 -0500 Subject: [PATCH] Add lowercase strings to Lua enum reverse table Step one toward compatibility with case-insensitive legacy command syntax. --- src/EnumHelper.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/EnumHelper.h b/src/EnumHelper.h index dc1049cc0c..d3bf4267f3 100644 --- a/src/EnumHelper.h +++ b/src/EnumHelper.h @@ -135,6 +135,11 @@ static void Lua##X(lua_State* L) \ lua_pushstring( L, (#X "_")+s ); \ lua_pushnumber( L, i ); /* 0-based */ \ lua_rawset( L, -3 ); \ + /* Compatibility with old, case-insensitive values */ \ + s.MakeLower(); \ + lua_pushstring( L, s ); \ + lua_pushnumber( L, i ); /* 0-based */ \ + lua_rawset( L, -3 ); \ } \ EnumTraits::StringToEnum.SetFromStack( L ); \ EnumTraits::StringToEnum.PushSelf( L ); \