public static StkId GetFunction(this LuaTable table, int key) { if (0 < key && key - 1 < table.ArrayPart.Length) { return(table.ArrayPart[key - 1]); } var k = new TValue(); k.SetNValue(key); for (var node = table.GetHashNode(ref k); node != null; node = node.Next) { if (node.Val.V.TtIsFunction()) { return(node.Val); } } return(LuaTable.TheNilValue); }