From 62a7483e4192fddb2a19a07dc2b0edacef4f5fb2 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Tue, 28 Apr 2020 22:22:45 -0700 Subject: [PATCH] rename lua test file + fix C++ warnings --- luarocks/LuaWebSocket.h | 8 ++++---- luarocks/{ia.lua => echo_client.lua} | 0 luarocks/functions.hpp | 13 ++++++++----- luarocks/luawrapper.hpp | 2 +- luarocks/main.cpp | 4 ++-- 5 files changed, 15 insertions(+), 12 deletions(-) rename luarocks/{ia.lua => echo_client.lua} (100%) diff --git a/luarocks/LuaWebSocket.h b/luarocks/LuaWebSocket.h index 26c687f3..f70089e4 100644 --- a/luarocks/LuaWebSocket.h +++ b/luarocks/LuaWebSocket.h @@ -68,7 +68,7 @@ namespace ix std::mutex _queueMutex; }; - LuaWebSocket* WebSocket_new(lua_State* L) + LuaWebSocket* WebSocket_new(lua_State* /*L*/) { LuaWebSocket* webSocket = new LuaWebSocket(); return webSocket; @@ -125,11 +125,11 @@ namespace ix return 1; } - // This should be a static method + // FIXME: This should be a static method, or be part of a different module int WebSocket_sleep(lua_State* L) { - LuaWebSocket* luaWebSocket = luaW_check(L, 1); - int duration = luaL_checkinteger(L, 2); + // LuaWebSocket* luaWebSocket = luaW_check(L, 1); + auto duration = luaL_checkinteger(L, 2); std::this_thread::sleep_for(std::chrono::milliseconds(duration)); return 0; } diff --git a/luarocks/ia.lua b/luarocks/echo_client.lua similarity index 100% rename from luarocks/ia.lua rename to luarocks/echo_client.lua diff --git a/luarocks/functions.hpp b/luarocks/functions.hpp index d64b983d..de6313f7 100644 --- a/luarocks/functions.hpp +++ b/luarocks/functions.hpp @@ -1,12 +1,15 @@ -#ifndef FUNCTIONS_HPP -#define FUNCTIONS_HPP +/* + * functions.hpp + * Author: Benjamin Sergeant + * Copyright (c) 2020 Machine Zone, Inc. All rights reserved. + */ + +#pragma once #include -int lua_info(lua_State* L) +int lua_info(lua_State* /*L*/) { std::cout << "C++ Lua v0.1" << std::endl << std::endl; return 0; } - -#endif // FUNCTIONS_HPP \ No newline at end of file diff --git a/luarocks/luawrapper.hpp b/luarocks/luawrapper.hpp index a8f62f36..9e4aa1a1 100644 --- a/luarocks/luawrapper.hpp +++ b/luarocks/luawrapper.hpp @@ -58,7 +58,7 @@ extern "C" // A simple utility function to adjust a given index // Useful for when a parameter index needs to be adjusted // after pushing or popping things off the stack -inline int luaW_correctindex(lua_State* L, int index, int correction) +inline int luaW_correctindex(lua_State* /*L*/, int index, int correction) { return index < 0 ? index - correction : index; } diff --git a/luarocks/main.cpp b/luarocks/main.cpp index 25420f34..60d4960b 100644 --- a/luarocks/main.cpp +++ b/luarocks/main.cpp @@ -30,9 +30,9 @@ int main() // // Simple version does little error handling - // luaL_dofile(L, "ia.lua"); + // luaL_dofile(L, "echo_client.lua"); // - std::string luaFile("ia.lua"); + std::string luaFile("echo_client.lua"); int loadStatus = luaL_loadfile(L, luaFile.c_str()); if (loadStatus) {