files
syscalls/src/syscalls.h

57 lines
805 B
C

#ifndef __SYSCALLS_H__
#define __SYSCALLS_H__
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
inline void syscalls_ReturnIntegerOrNil(LUA_INTEGER value, lua_State* L)
{
if (value == -1)
{
lua_pushnil(L);
}
else
{
lua_pushinteger(L, value);
}
}
inline void syscalls_ReturnIntegerValueOrNil(LUA_INTEGER cond, LUA_INTEGER value, lua_State* L)
{
if (cond == -1)
{
lua_pushnil(L);
}
else
{
lua_pushinteger(L, value);
}
}
inline void syscalls_ReturnTrueOrNil(LUA_INTEGER value, lua_State* L)
{
if (value == -1)
{
lua_pushnil(L);
}
else
{
lua_pushboolean(L, 1);
}
}
inline void syscalls_ReturnStringOrNil(LUA_INTEGER cond, const char* value, lua_State* L)
{
if (cond == -1)
{
lua_pushnil(L);
}
else
{
lua_pushstring(L, value);
}
}
#endif // __SYSCALLS_H__