From 801840a44257d95376a5f7d5fe97d87b9f16bd93 Mon Sep 17 00:00:00 2001 From: sanine Date: Tue, 24 Aug 2021 22:08:56 -0500 Subject: update README types and fix bug in C function tests --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 9a63e74..432100b 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,8 @@ These constants are used when honeysuckle needs to know a type to expect. - `HS_BOOL` - booleans -- `HS_INT` - integers -- `HS_NUM` - numbers (double by default) +- `HS_INT` - lua_Integer (aka long int) +- `HS_NUM` - lua_Number (aka double) - `HS_STR` - strings - `HS_TBL` - tables - `HS_FUNC` - any function @@ -100,7 +100,7 @@ only parse up to 255 arguments. int some_lua_binding(lua_State *L) { bool b; - int i; + lua_Integer i; int tbl_index; lua_Number n; char *str; @@ -135,19 +135,19 @@ function throws an error. ```c int overloaded_lua_binding(lua_State *L) { - int i; - float f; + long int i; + double n; char *str; int choice = hs_parse_overloaded(L, hs_overload( hs_int(i) ), - hs_overload( hs_str(str), hs_num(f) ) + hs_overload( hs_str(str), hs_num(n) ) ); if (choice == 0) { // do something with i - // str and f remain unassigned!! + // str and n remain unassigned!! } else { - // choice == 1, do something with str and f + // choice == 1, do something with str and n // i remains unassigned!! } return 0; @@ -163,7 +163,7 @@ struct hs_tbl_entry`s. These can either be constructed by hand, or via function-like macros identified by lowercase versions of the typenames shown above (e.g. `hs_str_int` would create a string key with integer value). Most of the type constants expect their -associated type (e.g. `HS_INT` expects an `int`, `HS_CFUNC` expects ` +associated type (e.g. `HS_INT` expects a `long int`, `HS_CFUNC` expects ` lua_CFunction`, etc.) but `HS_FUNC`, `HS_USER`, and `HS_TBL` expect an integer stack index. You cannot use `HS_NIL` or `HS_ANY` with this function. @@ -221,7 +221,7 @@ void open_logfile(const char *logfile, void *settings) { struct settings { bool debug; - int verbosity; + long int verbosity; float epsilon; }; -- cgit v1.2.1