Skip to content

Commit

Permalink
Fix misleading indentation and add brackets (otland#3992)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranisalt authored and EPuncker committed May 22, 2023
1 parent d61ec94 commit 5c77b63
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/luascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4197,14 +4197,15 @@ int LuaScriptInterface::luaTablePack(lua_State* L)
{
// table.pack(...)
int i;
int n = lua_gettop(L); /* number of elements to pack */
lua_createtable(L, n, 1); /* create result table */
lua_insert(L, 1); /* put it at index 1 */
for (i = n; i >= 1; i--) /* assign elements */
int n = lua_gettop(L); /* number of elements to pack */
lua_createtable(L, n, 1); /* create result table */
lua_insert(L, 1); /* put it at index 1 */
for (i = n; i >= 1; i--) { /* assign elements */
lua_rawseti(L, 1, i);
if (luaL_callmeta(L, -1, "__index") != 0) {
lua_replace(L, -2);
}
}
if (luaL_callmeta(L, -1, "__index") != 0) {
lua_replace(L, -2);
}
lua_pushinteger(L, n);
lua_setfield(L, 1, "n"); /* t.n = number of elements */
return 1; /* return table */
Expand Down

0 comments on commit 5c77b63

Please sign in to comment.