Skip to content
This repository has been archived by the owner on Sep 24, 2023. It is now read-only.

Commit

Permalink
Fix behavior of Push and add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nosoop committed Nov 7, 2018
1 parent 17df8b8 commit f795fa1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 4 additions & 3 deletions scripting/include/level_keyvalues.inc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ methodmap LevelEntityList {
* The key / values are internally copied to a new handle, so any changes to the specified
* LevelEntityKeyValues handle will not be propagated to the internal copy.
*/
public static native void Push(LevelEntityKeyValues entity);
public static native int Push(LevelEntityKeyValues entity);

/**
* Returns the number of LevelEntityKeyValues handles in the list.
Expand All @@ -82,8 +82,9 @@ forward Action LevelEntity_OnEntityKeysParsed(LevelEntityKeyValues entity);

/**
* Called when the entity string in `OnLevelInit` has been fully parsed out.
* Any modifications to the LevelEntityList or its member LevelEntityKeyValues will be written
* out to the entity string.
*
* During this forward, modifications to the LevelEntityList or its member LevelEntityKeyValues
* are guaranteed to be written out to the entity string.
*/
forward void LevelEntity_OnAllEntitiesParsed();

Expand Down
3 changes: 1 addition & 2 deletions scripting/level_keyvalues.sp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ public int Native_InsertEntity(Handle plugin, int argc) {
ThrowNativeError(1, "Can't push new entity into list during non-mutable state.");
}
StringMultiMap entity = GetNativeCell(1);
g_MapEntities.Push(CloneStringMultiMap(entity));
return;
return g_MapEntities.Push(CloneStringMultiMap(entity));
}

public int Native_LevelListGetLength(Handle plugin, int argc) {
Expand Down

0 comments on commit f795fa1

Please sign in to comment.