Commit b210d0c 1 parent 1bde771 commit b210d0c Copy full SHA for b210d0c
File tree 1 file changed +17
-3
lines changed
1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -951,8 +951,22 @@ namespace ConfigValueReg {
951
951
// an<T> make(){
952
952
// return New<T>();
953
953
// };
954
- an<T> make (string s){
955
- return New<T>(s);
954
+
955
+ int raw_make (lua_State *L) {
956
+ an<T> t = New<T>();
957
+ if (lua_gettop (L) > 0 && !lua_isnil (L, 1 )) {
958
+ if (lua_isstring (L, 1 )) {
959
+ t->SetString (lua_tostring (L, 1 ));
960
+ }
961
+ else if (lua_isboolean (L, 1 )){
962
+ t->SetBool (lua_toboolean (L, 1 ));
963
+ }
964
+ else {
965
+ LOG (WARNING) << " args #1 type error: " << luaL_typename (L, 1 );
966
+ }
967
+ }
968
+ LuaType<an<T>>::pushdata (L, t);
969
+ return 1 ;
956
970
};
957
971
958
972
optional<bool > get_bool (T &t) {
@@ -1006,7 +1020,7 @@ namespace ConfigValueReg {
1006
1020
}
1007
1021
1008
1022
static const luaL_Reg funcs[] = {
1009
- {" ConfigValue" , WRAP (make )},
1023
+ {" ConfigValue" ,(raw_make )},
1010
1024
{ NULL , NULL },
1011
1025
};
1012
1026
You can’t perform that action at this time.
0 commit comments