Commit Graph

11 Commits

Author SHA1 Message Date
Pasi Kallinen
e215f09ddb Fix even more warnings 2020-04-06 13:34:07 +03:00
Pasi Kallinen
1d312ee3fe Add some player lua methods
Adds u.clear_inventory() and u.giveobj(new.obj("rock")) and some other minor stuff.
2020-01-04 16:55:53 +02:00
Pasi Kallinen
a018930964 Update map glyph when placing obj on map via lua 2020-01-04 11:35:17 +02:00
Pasi Kallinen
7e07cef197 Lua struct obj improvements
If the core frees the obj struct referred by lua, don't free it,
just mark it as OBJ_LUAFREE - lua will free it in gc once all
the references to it are gone.
2020-01-01 13:25:59 +02:00
Pasi Kallinen
6d8d3a9557 Add lua object references
Whenever a lua script references a core struct obj, increment a counter
in the obj struct. Core code will not free the obj, if there are any
lua references pointing to it, just makes it free-floating.
When lua script ends, the lua gc will free the free-floating objects.

Also exposes u.inventory to lua.

Breaks save and bones compat.
2019-12-26 19:15:24 +02:00
nhmall
0bcebf7343 compiler warnings 2019-12-20 20:56:01 -05:00
nhmall
b956e1a205 silence some compiler warnings that showed up recently 2019-12-15 14:03:25 -05:00
Pasi Kallinen
1d9ba3e212 Expose objects array to lua 2019-12-12 13:39:20 +02:00
Pasi Kallinen
027024d27f More wish parser tests 2019-12-12 07:58:06 +02:00
PatR
a28b8e85a2 fix a couple of nhlobj.c warnings
unused: 'buf[]'
plain char subscript: [obj->oclass]
2019-12-11 12:48:31 -08:00
Pasi Kallinen
7043e2134a Lua NetHack obj bindings 2019-12-11 20:10:59 +02:00