state.cpp 326 B

123456789101112131415161718192021222324
  1. #include <luwra.hpp>
  2. #include <string>
  3. #include <iostream>
  4. using namespace luwra;
  5. int main() {
  6. StateWrapper state;
  7. state.loadStandardLibrary();
  8. state["foo"] = 1337;
  9. int r = state.runString(
  10. "print(foo)"
  11. );
  12. if (r != LUA_OK) {
  13. std::cerr << read<std::string>(state, -1) << std::endl;
  14. return 1;
  15. }
  16. return 0;
  17. }