Remove implicit conversion operator from RString to const char*
This is required for the RString to std::string migration. Mostly automated from https://github.com/aeubanks/rewriter/blob/main/c_str.cc, with some manual intervention required for fixing up `a + b.c_str()` to `(a + b).c_str()`. Added some overloads for some common global functions like sm_crash to reduce the number of changes required here.
This commit is contained in:
+7
-7
@@ -60,7 +60,7 @@ void LuaManager::SetGlobal( const RString &sName, int val )
|
||||
{
|
||||
Lua *L = Get();
|
||||
LuaHelpers::Push( L, val );
|
||||
lua_setglobal( L, sName );
|
||||
lua_setglobal( L, sName.c_str() );
|
||||
Release( L );
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ void LuaManager::SetGlobal( const RString &sName, const RString &val )
|
||||
{
|
||||
Lua *L = Get();
|
||||
LuaHelpers::Push( L, val );
|
||||
lua_setglobal( L, sName );
|
||||
lua_setglobal( L, sName.c_str() );
|
||||
Release( L );
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ void LuaManager::UnsetGlobal( const RString &sName )
|
||||
{
|
||||
Lua *L = Get();
|
||||
lua_pushnil( L );
|
||||
lua_setglobal( L, sName );
|
||||
lua_setglobal( L, sName.c_str() );
|
||||
Release( L );
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace
|
||||
|
||||
FOREACH_CONST_Attr( pNode, pAttr )
|
||||
{
|
||||
lua_pushstring( L, pAttr->first ); // push key
|
||||
lua_pushstring( L, pAttr->first.c_str() ); // push key
|
||||
pNode->PushAttrValue( L, pAttr->first ); // push value
|
||||
|
||||
//add key-value pair to our table
|
||||
@@ -153,7 +153,7 @@ namespace
|
||||
FOREACH_CONST_Child( pNode, c )
|
||||
{
|
||||
const XNode *pChild = c;
|
||||
lua_pushstring( L, pChild->m_sName ); // push key
|
||||
lua_pushstring( L, pChild->m_sName.c_str() ); // push key
|
||||
|
||||
// push value (more correctly, build this child's table and leave it there)
|
||||
CreateTableFromXNodeRecursive( L, pChild );
|
||||
@@ -784,7 +784,7 @@ bool LuaHelpers::RunScriptFile( const RString &sFile )
|
||||
bool LuaHelpers::LoadScript( Lua *L, const RString &sScript, const RString &sName, RString &sError )
|
||||
{
|
||||
// load string
|
||||
int ret = luaL_loadbuffer( L, sScript.data(), sScript.size(), sName );
|
||||
int ret = luaL_loadbuffer( L, sScript.data(), sScript.size(), sName.c_str() );
|
||||
if( ret )
|
||||
{
|
||||
LuaHelpers::Pop( L, sError );
|
||||
@@ -1080,7 +1080,7 @@ namespace
|
||||
static int CheckType( lua_State *L )
|
||||
{
|
||||
RString sType = SArg(1);
|
||||
bool bRet = LuaBinding::CheckLuaObjectType( L, 2, sType );
|
||||
bool bRet = LuaBinding::CheckLuaObjectType( L, 2, sType.c_str() );
|
||||
LuaHelpers::Push( L, bRet );
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user