mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Merge pull request #1926 from EngineerSmith/enet-data
Added variants for peer:send and host:broadcast which accepts light userdata and size
This commit is contained in:
@@ -79,6 +79,7 @@ Released: N/A
|
||||
* Added love.sensor module.
|
||||
* Added love.sensorupdated callback.
|
||||
* Added love.joysticksensorupdated callback.
|
||||
* Added variant for enet peer:send and host:broadcast which accepts a pointer (light userdata) and a size.
|
||||
|
||||
* Changed love.filesystem.exists to no longer be deprecated.
|
||||
* Changed the default font from Vera size 12 to Noto Sans size 13.
|
||||
|
||||
@@ -234,12 +234,21 @@ static void push_event(lua_State *l, ENetEvent *event) {
|
||||
|
||||
/**
|
||||
* Read a packet off the stack as a string
|
||||
* idx is position of string
|
||||
* idx is position of string or lightuserdata
|
||||
*/
|
||||
static ENetPacket *read_packet(lua_State *l, int idx, enet_uint8 *channel_id) {
|
||||
size_t size;
|
||||
int argc = lua_gettop(l);
|
||||
const void *data = luaL_checklstring(l, idx, &size);
|
||||
const void* data;
|
||||
|
||||
if (lua_islightuserdata(l, idx)) {
|
||||
data = lua_touserdata(l, idx);
|
||||
size = (size_t) luaL_checknumber(l, idx + 1);
|
||||
idx++;
|
||||
}
|
||||
else {
|
||||
data = luaL_checklstring(l, idx, &size);
|
||||
}
|
||||
ENetPacket *packet;
|
||||
|
||||
enet_uint32 flags = ENET_PACKET_FLAG_RELIABLE;
|
||||
|
||||
Reference in New Issue
Block a user