From 5250cb90406693163763a214af95f670e0e3a4e0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 5 Oct 2018 05:02:49 +0200 Subject: Add cross compilation (mingw-w64 x86_64) Currently only cross compiling from linux64 to win64 works. Need to test cross compilation more, currently the cross compilation uses same profile as GCC, is that correct? --- examples/hello_lua/src/main.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/hello_lua/src/main.cpp (limited to 'examples/hello_lua/src') diff --git a/examples/hello_lua/src/main.cpp b/examples/hello_lua/src/main.cpp new file mode 100644 index 0000000..57f9194 --- /dev/null +++ b/examples/hello_lua/src/main.cpp @@ -0,0 +1,31 @@ +#include +extern "C" { +#include +#include +#include +} +int main(int argc, char *argv[]) { + // Open lua + lua_State *L = lua_open(); + + // Load the libraries + luaL_openlibs(L); + + // Execution of a lua string + luaL_dostring(L, "print \"Yo dude\""); + + // Load a string and then execute it. + luaL_loadstring(L, "io.write(\"I'm here too\\n\")"); + lua_pcall(L, 0, LUA_MULTRET, 0); + + // Load from a file and then execute + if (luaL_loadfile(L, "hello.lua") == 0) { + // File loaded call it + lua_pcall(L, 0, LUA_MULTRET, 0); + } + + // Close lua + lua_close (L); + + return 0; +} -- cgit v1.2.3