mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Remove bogus userdata<T>
specialization; that's not longer how we're detecting userdata.
Fixed Readme example, removed bad uses of `local`
This commit is contained in:
parent
0a2050769c
commit
ad83552072
|
@ -31,7 +31,7 @@ struct vars {
|
|||
int main() {
|
||||
sol::state lua;
|
||||
lua.new_userdata<vars>("vars", "boop", &vars::boop);
|
||||
lua.script("local beep = vars.new()\n"
|
||||
lua.script("beep = vars.new()\n"
|
||||
"beep.boop = 1");
|
||||
assert(lua.get<vars>("beep").boop == 1);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ int main() {
|
|||
lua.new_userdata<variables>("variables", "low_gravity", &variables::low_gravity, "boost_level", &variables::boost_level);
|
||||
|
||||
// making the class from lua is simple
|
||||
// same with calling member functions
|
||||
// same with calling member functions/variables
|
||||
lua.script("local vars = variables.new()\n"
|
||||
"assert(not vars.low_gravity)\n"
|
||||
"vars.low_gravity = true\n"
|
||||
|
|
|
@ -96,16 +96,6 @@ class function;
|
|||
class object;
|
||||
|
||||
namespace detail {
|
||||
template<typename T>
|
||||
inline type usertype(std::true_type) {
|
||||
return type::userdata;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline type usertype(std::false_type) {
|
||||
return type::none;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline type arithmetic(std::true_type) {
|
||||
return type::number;
|
||||
|
@ -113,7 +103,7 @@ inline type arithmetic(std::true_type) {
|
|||
|
||||
template<typename T>
|
||||
inline type arithmetic(std::false_type) {
|
||||
return usertype<T>(is_specialization_of<T, userdata>{});
|
||||
return type::userdata;
|
||||
}
|
||||
} // detail
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user