values method
Gets count
number of values in the stack, starting at start
.
This returns values in the order that they were pushed, Example:
state.push("Hello");
state.push(1234);
state.push(4321);
print(state.values(3)); // prints [Hello, 1234, 4321]
The start
arg defaults to -count
, meaning it will return the
last count
values pushed to the stack.
Implementation
List<dynamic> values(int count, [int? start]) {
start ??= -count;
if (start < 0) start += lua_gettop(L) + 1;
return List<dynamic>.generate(count, (i) => at(start! + i));
}