Utility function that I didn't end up using but which could be useful elsewhere
This commit is contained in:
parent
ae50be5bbe
commit
d9d65e61b4
2 changed files with 17 additions and 0 deletions
|
@ -595,6 +595,17 @@ t_string luaW_checktstring(lua_State *L, int index)
|
|||
return result;
|
||||
}
|
||||
|
||||
bool luaW_isstring(lua_State* L, int index)
|
||||
{
|
||||
if(lua_isstring(L, index)) {
|
||||
return true;
|
||||
}
|
||||
if(lua_isuserdata(L, index) && luaL_testudata(L, index, tstringKey)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void luaW_filltable(lua_State *L, const config& cfg)
|
||||
{
|
||||
if (!lua_checkstack(L, LUA_MINSTACK))
|
||||
|
|
|
@ -78,6 +78,12 @@ bool luaW_totstring(lua_State *L, int index, t_string &str);
|
|||
*/
|
||||
t_string luaW_checktstring(lua_State *L, int index);
|
||||
|
||||
/*
|
||||
* Test if a scalar is either a plain or translatable string.
|
||||
* Also returns true if it's a number since that's convertible to string.
|
||||
*/
|
||||
bool luaW_isstring(lua_State* L, int index);
|
||||
|
||||
/**
|
||||
* Converts a config object to a Lua table.
|
||||
* The destination table should be at the top of the stack on entry. It is
|
||||
|
|
Loading…
Add table
Reference in a new issue