tableGet method

void tableGet([
  1. int tableIndex = -2
])

Pops a key and pushes the value in the table at tableIndex.

This does not pop the table, Example:

// Assuming the top of the stack is {myKey = "myValue"}
state.push("myKey");
state.tableGet();
// Top of stack is now "myValue", with the input table behind it.

If the table has a __index metamethod, this may invoke it, to avoid this behavior see LuaState.tableGetRaw

Implementation

void tableGet([int tableIndex = -2]) => lua_gettable(L, tableIndex);