| 19 | }; |
| 20 | |
| 21 | int main() { |
| 22 | sol::state lua; |
| 23 | config screen; |
| 24 | // To use the file, uncomment here and make sure it is in |
| 25 | // local dir lua.script_file("config.lua"); |
| 26 | lua.script(R"( |
| 27 | name = "Asus" |
| 28 | width = 1920 |
| 29 | height = 1080 |
| 30 | )"); |
| 31 | screen.name = lua.get<std::string>("name"); |
| 32 | screen.width = lua.get<int>("width"); |
| 33 | screen.height = lua.get<int>("height"); |
| 34 | SOL_ASSERT(screen.name == "Asus"); |
| 35 | SOL_ASSERT(screen.width == 1920); |
| 36 | SOL_ASSERT(screen.height == 1080); |
| 37 | |
| 38 | std::cout << "=== config ===" << std::endl; |
| 39 | screen.print(); |
| 40 | std::cout << std::endl; |
| 41 | } |