diff --git a/3rd/lua_bridge/src/lua_bridge.cpp b/3rd/lua_bridge/src/lua_bridge.cpp index 8fcef061..ed464c98 100644 --- a/3rd/lua_bridge/src/lua_bridge.cpp +++ b/3rd/lua_bridge/src/lua_bridge.cpp @@ -226,6 +226,33 @@ void lua_push_from_python(VM* vm, PyObject* val){ case VM::tp_str.index: lua_pushstring(_L, _CAST(CString, val)); return; + case VM::tp_tuple.index: { + lua_newtable(_L); + int i = 1; + for(PyObject* obj: PK_OBJ_GET(Tuple, val)){ + lua_push_from_python(vm, obj); + lua_rawseti(_L, -2, i++); + } + return; + } + case VM::tp_list.index: { + lua_newtable(_L); + int i = 1; + for(PyObject* obj: PK_OBJ_GET(List, val)){ + lua_push_from_python(vm, obj); + lua_rawseti(_L, -2, i++); + } + return; + } + case VM::tp_dict.index: { + lua_newtable(_L); + PK_OBJ_GET(Dict, val).apply([&](PyObject* key, PyObject* val){ + lua_push_from_python(vm, key); + lua_push_from_python(vm, val); + lua_settable(_L, -3); + }); + return; + } } if(is_non_tagged_type(val, PyLuaTable::_type(vm))){ diff --git a/docs/bindings_lua.md b/docs/bindings_lua.md index cef89fa7..05f57f3a 100644 --- a/docs/bindings_lua.md +++ b/docs/bindings_lua.md @@ -63,6 +63,9 @@ If you pass an unsupported type, an exception will be raised. | `int` | `number` | YES | | `float` | `number` | YES | | `str` | `string` | YES | +| `tuple` | `table` | YES | +| `list` | `table` | YES | +| `dict` | `table` | YES | | `lua.Table` | `table` | YES | | `lua.Function`| `function`| NO |