rename lua test file + fix C++ warnings
This commit is contained in:
parent
36fbdd0daa
commit
62a7483e41
@ -68,7 +68,7 @@ namespace ix
|
|||||||
std::mutex _queueMutex;
|
std::mutex _queueMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
LuaWebSocket* WebSocket_new(lua_State* L)
|
LuaWebSocket* WebSocket_new(lua_State* /*L*/)
|
||||||
{
|
{
|
||||||
LuaWebSocket* webSocket = new LuaWebSocket();
|
LuaWebSocket* webSocket = new LuaWebSocket();
|
||||||
return webSocket;
|
return webSocket;
|
||||||
@ -125,11 +125,11 @@ namespace ix
|
|||||||
return 1;
|
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)
|
int WebSocket_sleep(lua_State* L)
|
||||||
{
|
{
|
||||||
LuaWebSocket* luaWebSocket = luaW_check<LuaWebSocket>(L, 1);
|
// LuaWebSocket* luaWebSocket = luaW_check<LuaWebSocket>(L, 1);
|
||||||
int duration = luaL_checkinteger(L, 2);
|
auto duration = luaL_checkinteger(L, 2);
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(duration));
|
std::this_thread::sleep_for(std::chrono::milliseconds(duration));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -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>
|
#include <iostream>
|
||||||
|
|
||||||
int lua_info(lua_State* L)
|
int lua_info(lua_State* /*L*/)
|
||||||
{
|
{
|
||||||
std::cout << "C++ Lua v0.1" << std::endl << std::endl;
|
std::cout << "C++ Lua v0.1" << std::endl << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FUNCTIONS_HPP
|
|
@ -58,7 +58,7 @@ extern "C"
|
|||||||
// A simple utility function to adjust a given index
|
// A simple utility function to adjust a given index
|
||||||
// Useful for when a parameter index needs to be adjusted
|
// Useful for when a parameter index needs to be adjusted
|
||||||
// after pushing or popping things off the stack
|
// 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;
|
return index < 0 ? index - correction : index;
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ int main()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Simple version does little error handling
|
// 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());
|
int loadStatus = luaL_loadfile(L, luaFile.c_str());
|
||||||
if (loadStatus)
|
if (loadStatus)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user