rename lua test file + fix C++ warnings

This commit is contained in:
Benjamin Sergeant 2020-04-28 22:22:45 -07:00
parent 36fbdd0daa
commit 62a7483e41
5 changed files with 15 additions and 12 deletions

View File

@ -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<LuaWebSocket>(L, 1);
int duration = luaL_checkinteger(L, 2);
// LuaWebSocket* luaWebSocket = luaW_check<LuaWebSocket>(L, 1);
auto duration = luaL_checkinteger(L, 2);
std::this_thread::sleep_for(std::chrono::milliseconds(duration));
return 0;
}

View File

@ -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 <iostream>
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

View File

@ -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;
}

View File

@ -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)
{