mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
57d9a05f88
- 🛠 Make sure the tutorials compile across platforms! - ✍ Redo quite a bit of the documentation
18 lines
344 B
C++
18 lines
344 B
C++
#define SOL_ALL_SAFETIES_ON 1
|
|
#include <sol/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;
|
|
}
|