sol2/examples/docs/as_table_ipairs.cpp
ThePhD 6c40c559e3 prepare for new usertype
change how type T is gleaned from destructors and constructors in case of new syntax
add a hell of a lot more examples, update and clean documentation
2018-03-15 17:16:28 -04:00

15 lines
316 B
C++

#define SOL_CHECK_ARGUMENTS 1
#include <sol.hpp>
#include <vector>
int main (int, char*[]) {
sol::state lua;
lua.open_libraries();
lua.set("my_table", sol::as_table(std::vector<int>{ 1, 2, 3, 4, 5 }));
lua.script("for k, v in ipairs(my_table) do print(k, v) assert(k == v) end");
return 0;
}