Skip to content

Commit 887ed4b

Browse files
committed
Code cleanups as suggested by Twisol
1 parent 2091f10 commit 887ed4b

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

scripting/lua_methods.cpp

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,17 +1070,11 @@ static int L_CallPlugin (lua_State *L)
10701070
break;
10711071

10721072
case LUA_TBOOLEAN:
1073-
{
1074-
int b = lua_toboolean (L, i);
1075-
lua_pushboolean (pL, b);
1076-
}
1073+
lua_pushboolean (pL, lua_toboolean (L, i));
10771074
break;
10781075

10791076
case LUA_TNUMBER:
1080-
{
1081-
double num = lua_tonumber (L, i);
1082-
lua_pushnumber (pL, num);
1083-
}
1077+
lua_pushnumber (pL, lua_tonumber (L, i));
10841078
break;
10851079

10861080
case LUA_TSTRING:
@@ -1097,7 +1091,7 @@ static int L_CallPlugin (lua_State *L)
10971091
lua_pushnumber (L, eBadParameter);
10981092
CString strError = TFormat ("Cannot pass argument #%i (%s type) to CallPlugin",
10991093
i,
1100-
lua_typename (L, lua_type (L, i)));
1094+
luaL_typename (L, i));
11011095
lua_pushstring (L, strError);
11021096
return 2; // eBadParameter, explanation
11031097

@@ -1196,17 +1190,11 @@ static int L_CallPlugin (lua_State *L)
11961190
break;
11971191

11981192
case LUA_TBOOLEAN:
1199-
{
1200-
int b = lua_toboolean (pL, i);
1201-
lua_pushboolean (L, b);
1202-
}
1193+
lua_pushboolean (L, lua_toboolean (pL, i));
12031194
break;
12041195

12051196
case LUA_TNUMBER:
1206-
{
1207-
double num = lua_tonumber (pL, i);
1208-
lua_pushnumber (L, num);
1209-
}
1197+
lua_pushnumber (L, lua_tonumber (pL, i));
12101198
break;
12111199

12121200
case LUA_TSTRING:
@@ -1222,7 +1210,7 @@ static int L_CallPlugin (lua_State *L)
12221210
lua_pushnumber (L, eErrorCallingPluginRoutine);
12231211
CString strError = CFormat ("Cannot handle return value #%i (%s type) from function '%s' in plugin '%s' (%s)",
12241212
i,
1225-
lua_typename (pL, lua_type (pL, i)),
1213+
luaL_typename (pL, i),
12261214
sRoutine,
12271215
(LPCTSTR) pPlugin->m_strName,
12281216
sPluginID);

0 commit comments

Comments
 (0)