This is a replacement for luaL_typerror , removed from Lua 5.2, which corrects the spelling.

NOTE:
There is one failing test in.the /test/testsrvr.lua and /test/testclnt.lua combination which was present in the repo I cloned from.
This commit is contained in:
Liam Devine 2011-07-04 23:35:16 +01:00 committed by Sam Roberts
parent e15ed19db6
commit c8eed36788
2 changed files with 17 additions and 0 deletions

10
src/lua_typeerror.c Normal file
View File

@ -0,0 +1,10 @@
#include "lua_typeerror.h"
#include "lua.h"
#include "lauxlib.h"
int luaL_typeerror (lua_State *L, int narg, const char *tname)
{
const char *msg = lua_pushfstring(L, "%s expected, got %s",tname, luaL_typename(L, narg));
return luaL_argerror(L, narg, msg);
}

7
src/lua_typeerror.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef LUA_TYPEERROR_H_
#define LUA_TYPEERROR_H_
struct lua_State;
int luaL_typeerror (struct lua_State *L, int narg, const char *tname);
#endif