diff options
author | sanine-a <sanine.not@pm.me> | 2020-10-24 21:35:14 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2020-10-24 21:35:14 -0500 |
commit | 41ac253f743e464194587c3ecc0f2547c95d924d (patch) | |
tree | 3a922066ecdf24bc5c33e200585cd70ecf4e080a /src/honey_lua.c | |
parent | 27292f0d9ed90340792d4d065fefd2e4e248e4bd (diff) |
add window module and fullscreen toggle
Diffstat (limited to 'src/honey_lua.c')
-rw-r--r-- | src/honey_lua.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/honey_lua.c b/src/honey_lua.c index ded2a91..4dd0667 100644 --- a/src/honey_lua.c +++ b/src/honey_lua.c @@ -132,6 +132,36 @@ bool honey_lua_validate_types(lua_State* L, } break; + case HONEY_USERDATA: + if (!lua_isuserdata(L, i+1)) { + result = honey_format_string(&error_message, + "Expected userdata in position %d", + i); + if (result != HONEY_OK) + lua_pushstring(L, "Expected userdata; allocation error occurred for more detailed message."); + else { + lua_pushstring(L, error_message); + free(error_message); + } + return false; + } + break; + + case HONEY_LIGHTUSERDATA: + if (!lua_islightuserdata(L, i+1)) { + result = honey_format_string(&error_message, + "Expected C pointer in position %d", + i); + if (result != HONEY_OK) + lua_pushstring(L, "Expected C pointer; allocation error occurred for more detailed message."); + else { + lua_pushstring(L, error_message); + free(error_message); + } + return false; + } + break; + case HONEY_ANY: break; @@ -185,6 +215,19 @@ void honey_lua_push_element(lua_State* L, honey_lua_element element) element.data.table.n_elements); break; + case HONEY_NIL: + lua_pushnil(L); + break; + + case HONEY_USERDATA: + /* cannot push userdata, push nil */ + lua_pushnil(L); + break; + + case HONEY_LIGHTUSERDATA: + lua_pushlightuserdata(L, element.data.pointer); + break; + default: // this should never happen break; |