コード例 #1
0
def anytype_variable_set(variable, ctype):
    refvar = variable

    if not variable.ctype.is_pointer() and not variable.ctype.is_reference():        
        return 'lua_pushlightuserdata(L, %s)' % (cpp.cpp_cast(cpp.cpp_type('void', pointer=True), 'new {}({})'.format(variable.ctype.name, variable.name)))

    return 'lua_pushlightuserdata(L, %s)' % (refvar.cast(cpp.cpp_cast, cpp.cpp_type('void', pointer=True)))
コード例 #2
0
ファイル: lua_cpp11.py プロジェクト: scooterman/pymunch
def cpp_unique_ptr_to_target(variable, ctype):
    return 'lua_pushlightuserdata(L, %s)' % (cpp.cpp_cast(cpp.cpp_type('void', pointer=True), 'new {}(std::move({}))'.format(variable.ctype.name, variable.name)))