-
Notifications
You must be signed in to change notification settings - Fork 38
Tips and tricks
SilverIce edited this page Aug 31, 2016
·
17 revisions
- Use Sublime Text editor & SublimePapyrus
- Prefix object's identifiers with
jor any other keyword. This will help distinguish an object's identifier from a plain number - If possible, avoid construction of lots of temporary objects inside of a loop, try re-use. Example below creates 2000 of JArray objects, each object will exist 10 seconds:
int i = 0
while i < 2000
int jlist = JArray.object()
...
endwhileExample of re-use:
int jlist = JArray.object()
int i = 0
while i < 2000
JValue.clear(jlist)
...
endwhileEither it's design pitfall (well, alternative way would reduce default object's lifetime which may break backward compatibility or introduce new function capable to force JC destroy an object or leave everything as it is).
- If possible, store backups, user's settings (i.e. dynamically-generated info) out of the Data folder:
JValue.writeToFile(jSettings, JContainers.usersDirectory() + "MyBackupFolder/backup.json")Do not mix constant data and user's data. Why:
-
You won't force users to run Skyrim as admin or permit Skyrim to write into the Data folder
-
Mod Organizer users are happy as they won't have to deal with their overwrite-folder pollution
-
JArray's index access is always faster than any of J*Map's key access - O(1) faster than O(log N). E.g. JArray access is faster than JIntMap.
Sign into GitHub and press Edit at the top to add any missing information or fix typos and errors. Thanks!