tibia-client/modules
Konrad Kuśnierz 7ea6c46b2c Add binary operations for lua
This is something I was always missing - posibbility to operate on
binary files or streams in pure lua. In most cases we do only need to
read simple variables from files such as integers with different amount
of bytes. This "class" will provide that ability.

It's a simple implementation of following C module for lua:
http://www.inf.puc-rio.br/~roberto/struct/

It has much less, though. Following elements have been implemented:

">" flag to set mode to big endian.
"<" flag to set mode to little endian.
"b" a signed char.
"B" an unsigned char.
"h" a signed short (2 bytes).
"H" an unsigned short (2 bytes).
"i" a signed int (4 bytes).
"I" an unsigned int (4 bytes).
"l" a signed long (8 bytes).
"L" an unsigned long (8 bytes).
"s" a zero-terminated string.

An example how to use it:

```lua
local packed = Struct.pack('<LIhBsb', 123456789123456789, 123456789,
-3200, 255, 'Test message', -1)
-- packed is now a lua string we can save to file as binary data
local L, I, h, B, s, b = Struct.unpack('<LIhBsb', packed)
print(L, I, h, B, s, b)
```

You can use g_resources.readFileContents as function to read binary
files and parse them via this class.
2015-05-18 21:38:05 +02:00
..
.project Added sublime text 2 project file. 2013-05-12 21:16:43 +12:00
client Keep g_settings as a 'static' variable rather than a direct object. 2014-04-01 16:51:38 +13:00
client_background Minimap, hotkeys and lot of other changes 2013-02-21 17:03:05 -03:00
client_entergame Full protocol 10.74 support (session key), entergame style fixes 2015-01-27 23:44:37 +01:00
client_locales Added locale number formatting to locale files 2015-01-20 16:18:04 +01:00
client_modulemanager Started implementing ability to load custom config files (currently unstable). 2014-04-01 05:43:31 +13:00
client_options Get rid of trailing whitespace. 2014-01-18 15:09:26 +01:00
client_serverlist Some style fixes & menu-scroll to add server. 2014-07-26 21:56:51 +12:00
client_stats Update to version 0.6.5 2014-01-06 19:02:45 -02:00
client_styles Minor changes in file type handling 2013-01-27 23:23:53 -02:00
client_terminal Terminal new line (Shift+Enter) functionality 2015-03-07 16:32:45 +01:00
client_topmenu Tiny topmenu fix 2014-02-22 02:21:09 +01:00
corelib Add binary operations for lua 2015-05-18 21:38:05 +02:00
game_battle Fix battlelist square bug / Cleanup 2014-05-29 03:17:48 +02:00
game_bugreport Refactor modules, closes #223 2013-01-18 20:46:36 -02:00
game_combatcontrols Fix dat loading issue with 10.00 & minor outfit window fix. 2014-12-30 17:27:53 +13:00
game_console Add tab-spacing tag to MoveableTabBars 2015-04-20 03:32:32 +02:00
game_containers Browse field, locked & paginated container support 2014-07-15 23:27:44 +02:00
game_cooldown Some minor changes/additions. 2014-08-07 06:40:56 +12:00
game_healthinfo Fix a crash issue when attempting to draw invalid item. 2014-07-11 16:19:30 +12:00
game_hotkeys Started 1050 implementation and fix ups: 2014-08-03 10:02:28 +12:00
game_interface Fix #576, PopupMenus close when leaving the game 2015-04-19 13:56:03 +02:00
game_inventory Updated advernturer blessing inventory style to be more robust 2015-01-19 01:52:49 +01:00
game_market Market now highlights offers which differ from the average price 2015-01-25 13:41:00 +01:00
game_minimap Started 1050 implementation and fix ups: 2014-08-03 10:02:28 +12:00
game_modaldialog Fix modal dialog auto sizing, fixes #556 2015-04-20 19:22:50 +02:00
game_npctrade Fix #576, PopupMenus close when leaving the game 2015-04-19 13:56:03 +02:00
game_outfit Fix dat loading issue with 10.00 & minor outfit window fix. 2014-12-30 17:27:53 +13:00
game_playerdeath Protocol 10.76, fixed death window & death packet 2015-03-07 06:10:10 +01:00
game_playermount Re-add destroying for unloading, other clean up: 2013-02-01 17:32:15 +13:00
game_playertrade Refactor modules, closes #223 2013-01-18 20:46:36 -02:00
game_questlog Re-add destroying for unloading, other clean up: 2013-02-01 17:32:15 +13:00
game_ruleviolation Remove test statement 2014-07-12 18:47:35 +02:00
game_skills Get rid of trailing whitespace. 2014-01-18 15:09:26 +01:00
game_spelllist Started 1050 implementation and fix ups: 2014-08-03 10:02:28 +12:00
game_textmessage Merge pull request #632 from SuggestName/master 2015-02-23 11:49:05 -03:00
game_textwindow Hide item image box when editing house lists 2014-10-05 19:24:34 +02:00
game_things Started 1050 implementation and fix ups: 2014-08-03 10:02:28 +12:00
game_unjustifiedpoints Little polishing of Unjustified Points module 2015-01-18 23:56:44 +01:00
game_viplist Fix #576, PopupMenus close when leaving the game 2015-04-19 13:56:03 +02:00
gamelib Fix #576, PopupMenus close when leaving the game 2015-04-19 13:56:03 +02:00