- bool is_boolean() const
- {
- return (bool)lua_isboolean(script_->state_, index);
- }
- bool is_imported_function() const
- {
- return (bool)lua_iscfunction(script_->state_, index);
- }
- bool is_function() const
- {
- return (bool)lua_isfunction(script_->state_, index);
- }
- bool is_nil() const
- {
- return (bool)lua_isnil(script_->state_, index);
- }
- bool is_none() const
- {
- return (bool)lua_isnone(script_->state_, index);
- }
- bool is_none_or_nil() const
- {
- return (bool)lua_isnoneornil(script_->state_, index);
- }
- bool is_number() const
- {
- return (bool)lua_isnumber(script_->state_, index);
- }
- bool is_string() const
- {
- return (bool)lua_isstring(script_->state_, index);
- }
- bool is_table() const
- {
- return (bool)lua_istable(script_->state_, index);
- }
- bool is_thread() const
- {
- return (bool)lua_isthread(script_->state_, index);
- }
- bool is_data() const
- {
- return (bool)lua_isuserdata(script_->state_, index);
- }
- bool is_light_data() const
- {
- return (bool)lua_islightuserdata(script_->state_, index);
- }
+#define IS_TYPE(T, N) \
+ bool is_##N() const \
+ { \
+ return (bool)lua_is##T(script_->state_, index); \
+ }//
+ IS_TYPE(boolean, boolean);
+ IS_TYPE(cfunction, imported_function);
+ IS_TYPE(function, function);
+ IS_TYPE(lightuserdata, light_data);
+ IS_TYPE(nil, nil);
+ IS_TYPE(none, none);
+ IS_TYPE(noneornil, none_or_nil);
+ IS_TYPE(number, number);
+ IS_TYPE(string, string);
+ IS_TYPE(table, table);
+ IS_TYPE(thread, thread);
+ IS_TYPE(userdata, data);
+#undef IS_TYPE