1 #ifndef _lua_int__hpp__included__
2 #define _lua_int__hpp__included__
12 std::string
get_string_argument(lua_State
* LS
, unsigned argindex
, const char* fname
);
13 bool get_boolean_argument(lua_State
* LS
, unsigned argindex
, const char* fname
);
14 extern lua_render_context
* lua_render_ctx
;
15 extern controls_t
* lua_input_controllerdata
;
19 T
get_numeric_argument(lua_State
* LS
, unsigned argindex
, const char* fname
)
21 if(lua_isnone(LS
, argindex
) || !lua_isnumber(LS
, argindex
)) {
23 sprintf(buffer
, "argument #%i to %s must be numeric", argindex
, fname
);
24 lua_pushstring(LS
, buffer
);
27 return static_cast<T
>(lua_tonumber(LS
, argindex
));
31 void get_numeric_argument(lua_State
* LS
, unsigned argindex
, T
& value
, const char* fname
)
33 if(lua_isnoneornil(LS
, argindex
))
35 if(lua_isnone(LS
, argindex
) || !lua_isnumber(LS
, argindex
)) {
37 sprintf(buffer
, "argument #%i to %s must be numeric if present", argindex
, fname
);
38 lua_pushstring(LS
, buffer
);
41 value
= static_cast<T
>(lua_tonumber(LS
, argindex
));