@@ -53,6 +53,7 @@ void CLuaResourceDefs::LoadFunctions()
5353 {" getResourceExportedFunctions" , getResourceExportedFunctions},
5454 {" getResourceOrganizationalPath" , getResourceOrganizationalPath},
5555 {" isResourceArchived" , isResourceArchived},
56+ {" isResourceProtected" , isResourceProtected},
5657
5758 // Set stuff
5859 {" setResourceInfo" , setResourceInfo},
@@ -121,6 +122,7 @@ void CLuaResourceDefs::AddClass(lua_State* luaVM)
121122 lua_classfunction (luaVM, " getState" , " getResourceState" );
122123 lua_classfunction (luaVM, " getACLRequests" , " getResourceACLRequests" );
123124 lua_classfunction (luaVM, " isArchived" , " isResourceArchived" );
125+ lua_classfunction (luaVM, " isProtected" , " isResourceProtected" );
124126
125127 lua_classvariable (luaVM, " dynamicElementRoot" , NULL , " getResourceDynamicElementRoot" );
126128 lua_classvariable (luaVM, " exportedFunctions" , NULL , " getResourceExportedFunctions" );
@@ -132,6 +134,7 @@ void CLuaResourceDefs::AddClass(lua_State* luaVM)
132134 lua_classvariable (luaVM, " rootElement" , NULL , " getResourceRootElement" );
133135 lua_classvariable (luaVM, " state" , NULL , " getResourceState" );
134136 lua_classvariable (luaVM, " archived" , NULL , " isResourceArchived" );
137+ lua_classvariable (luaVM, " protected" , nullptr , " isResourceProtected" );
135138 lua_classvariable (luaVM, " loadFailureReason" , NULL , " getResourceLoadFailureReason" );
136139 // lua_classvariable ( luaVM, "info", "setResourceInfo", "getResourceInfo", CLuaOOPDefs::SetResourceInfo, CLuaOOPDefs::GetResourceInfo ); // .key[value]
137140 // lua_classvariable ( luaVM, "defaultSetting", "setResourceDefaultSetting", NULL, CLuaOOPDefs::SetResourceDefaultSetting, NULL ); // .key[value]
@@ -1462,3 +1465,18 @@ int CLuaResourceDefs::isResourceArchived(lua_State* luaVM)
14621465 lua_pushnil (luaVM);
14631466 return 1 ;
14641467}
1468+
1469+ int CLuaResourceDefs::isResourceProtected (lua_State* luaVM)
1470+ {
1471+ // bool isResourceProtected ( resource theResource )
1472+ CResource* pResource;
1473+
1474+ CScriptArgReader argStream (luaVM);
1475+ argStream.ReadUserData (pResource);
1476+
1477+ if (argStream.HasErrors ())
1478+ return luaL_error (luaVM, argStream.GetFullErrorMessage ());
1479+
1480+ lua_pushboolean (luaVM, pResource->IsProtected ());
1481+ return 1 ;
1482+ }
0 commit comments