Project Zomboid

Project Zomboid

Not enough ratings
PhunLib
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
1.412 MB
21 Jan @ 12:23am
18 Jul @ 12:59am
10 Change Notes ( view )

Subscribe to download
PhunLib

Description
Shared functions for Phun mods
File tools
  • PhunLib.table.tableToString(table) - returns a string representation of a lua table
  • PhunLib.table.saveTable(filename, data) - saves a table to Lua\{filename}.lua
  • PhunLib.file.loadTable(filename, createIfNotExists*) - returns a table loaded from Lua\{filename}.lua
  • PhunLib.table.log(...) - appends the values passed to lua\Phun.log
Table tools
  • PhunLib.table.shallowCopy(original, excludeKeys*) - returns a shallow copy of original table. Optionally include an ArrayList of keys to exclude
  • PhunLib.table.deepCopy(original, excludeKeys*) - returns a deep copy of original table. Optionally include ArrayList of keys to exclude
  • PhunLib.table.merge(tableA, tableB, excludeKeys*) - returns a merged copy of 2 tables where tableA is merged into tableA. Optionally include an ArrayList of keys to exclude
String tools
  • PhunLib.string.formatWholeNumber(number) - takes a number and returns thousands separated string without any decimals (eg 2432.3 returns "2,432")
  • PhunLib.string.timeDifference(time1, time2*) - returns the number of years, months, hours, minutes and seconds as a number between 2 timestamps. time2 defaults to now
  • PhunLib.string.timeAgo(time1, time2*, defaultText*) - returns friendly text of time difference as string between timestamps. time2 defaults to now, defaultText defaults to "Just Now"
Events
  • PhunLib.events.OnDawn - triggered when its morning (configured via settings)
  • PhunLib.events.OnDusk - triggered when its evening (configured via settings)
  • PhunLib.events.OnReady - triggered when PhunLib is loaded
  • PhunLib.events.OnEmptyServer - triggered when PhunLib detects the server is empty (runs once per empty)
Misc tools
  • PhunLib.debug(...) - takes strings, numbers and/or tables and prints each out into readable format
  • PhunLib.printTable(...) - prints contents of table to console
  • PhunLib.onlinePlayers(...) - returns ArrayList of players regardless of if its single player. If called by client, returns only isLocalPlayers

Made for B41 and B42
[discord.gg]
Coded with love for our awesome PhunZoid[discord.gg] community. Repo and more info[github.com]

Workshop ID: 3411695932
Mod ID: phunlib