Skip to content

Commit

Permalink
Update HelloWorld.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
sfranzyshen committed Nov 1, 2019
1 parent 640fcf8 commit 1dfdf0b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/HelloWorld/HelloWorld.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

LuaWrapper lua;

static int lua_wrapper_print(lua_State *lua_state) {
String a = String(luaL_checkstring(lua_state, 1));
Serial.println(a);
}

void setup() {
lua.Lua_register("print", (const lua_CFunction) &lua_wrapper_print);
Serial.begin(115200);
String script = String("print('Hello world!')");
Serial.println(lua.Lua_dostring(&script));
Expand Down

0 comments on commit 1dfdf0b

Please sign in to comment.