+
+ int error = luaL_loadfile(lua_state, buf);
+ if(!error)
+ {
+ error = lua_pcall(lua_state, 0, LUA_MULTRET, 0); // once again, returns non-0 on error,
+ }
+ if(error) // if non-0, then an error
+ {
+ // the top of the stack should be the error string
+ if (!lua_isstring(lua_state, lua_gettop(lua_state)))
+ printf( "Error - but no error (?!)");
+
+ // get the top of the stack as the error and pop it off
+ const char * str = lua_tostring(lua_state, lua_gettop(lua_state));
+ lua_pop(lua_state, 1);
+ printf(str);
+ }
+
+ //luaL_dofile(lua_state, buf);