wrenpp/src/main.cpp

30 lines
576 B
C++
Raw Normal View History

#include "wren/vm_fun.hpp"
2020-04-25 18:45:59 +00:00
#include "wren/def_configuration.hpp"
#include <iostream>
#include <chrono>
#include <thread>
namespace {
const constexpr char g_script[] = ""
R"(class Math {
construct new() {}
foreign add(a, b)
}
System.print("I am running in a VM!")
var myvar = Math.new()
myvar.add(5, 6)
System.print("Script done")
)";
} //unnamed namespace
int main() {
std::cout << "hello world\n";
2020-04-25 18:45:59 +00:00
wren::DefConfiguration config;
wren::VM vm(&config);
vm.interpret("my_module", g_script);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
return 0;
}